The dwlfy library is a powerful and user-friendly tool designed to download videos from YouTube with options for video quality and format, along with an integrated MP3 conversion feature. This library is ideal for users who want flexibility in downloading, organizing, and converting YouTube content for offline use.
Project description
dwlfy
dwlfy is a powerful and user-friendly library designed to download videos from YouTube with options for video quality and format, along with an integrated MP3 conversion feature. Ideal for users seeking flexibility in downloading, organizing, and converting YouTube content for offline use.
Key Features
-
Video Download with Quality Selection: Specify the desired video quality (such as 1080p, 720p, 480p) before downloading, allowing customization based on device storage and playback requirements.
-
Audio Extraction and MP3 Conversion: Convert downloaded videos to MP3 format easily. This feature is perfect for users who want to save audio content separately, such as podcasts or music.
-
Cache System for Downloaded Videos: Prevent redundant downloads with a caching mechanism that detects previously downloaded videos, optimizing storage usage and saving bandwidth.
-
Batch Downloading: Provide a list of video URLs to download multiple videos sequentially or in parallel, saving time and increasing efficiency.
-
Multithreading Support: Speed up downloads by enabling simultaneous downloads through multithreading, which significantly boosts download speed.
-
Notifications: Optional notifications (such as email or system alerts) notify you once downloads are complete, providing a seamless and convenient user experience.
Technologies Used
- yt-dlp: For video extraction and downloading from YouTube.
- ffmpeg: For audio extraction and MP3 conversion.
Installation
To install dwlfy
, use pip
:
pip install dwlfy
You’ll also need to install ffmpeg for audio extraction and conversion. You can download it from ffmpeg.org.
Usage
Here's a quick overview of how to use dwlfy.
- Validate a YouTube URL The YouTubeURLValidator class can help ensure that a given URL is a valid YouTube link.
from dwlfy import YouTubeURLValidator
# Initialize the validator
validator = YouTubeURLValidator()
# Example YouTube URL
url = "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
# Validate the URL
if validator(url):
print("This is a valid YouTube URL!")
else:
print("Invalid YouTube URL.")
- Download a YouTube Video Use the Downloader class to download a YouTube video by providing its URL.
from dwlfy import Downloader
# Initialize the downloader
downloader = Downloader()
# Example YouTube URL
url = "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
# Download the video to a specific destination
destination = "/home/user/Downloads"
downloaded_file = downloader.download_video(
url=url,
destination=destination,
format_option="best", # Specify video quality, e.g., "best" or "worst"
height=720 # Optional: Max video resolution (e.g., 720p)
)
if downloaded_file:
print(f"Video successfully downloaded to: {downloaded_file}")
else:
print("Failed to download the video.")
- Download and Convert a YouTube Video to MP3 You can also download a YouTube video and convert it to an audio format, such as MP3.
from dwlfy import Downloader
# Initialize the downloader
downloader = Downloader()
# Example YouTube URL
url = "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
# Download and convert the video to MP3
download_dir = "downloads"
destination = "/home/user/Downloads"
converted_file = downloader.download_and_convert(
url=url,
download_dir=download_dir,
destination=destination,
conversion_format="mp3" # Specify the target audio format
)
if converted_file:
print(f"Audio successfully downloaded and converted to: {converted_file}")
else:
print("Failed to download or convert the video.")
Use Cases
dwlfy is suitable for anyone looking to download and organize YouTube videos efficiently, whether for offline access, educational purposes, or personal entertainment.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file DWLFY-1.0.0.tar.gz
.
File metadata
- Download URL: DWLFY-1.0.0.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 55ca9236824efff674c4e44cc7c6fc3d21647c11811f75f23dea8f830a1adc78 |
|
MD5 | ba796d89ebd17fd4d06f6ea3a2ddb5f3 |
|
BLAKE2b-256 | 3eab53ba3d1f1f4d5ce0a8fc0dec84ba2be7c0c8c0f2dbcbcfe2db8598ea1817 |
File details
Details for the file DWLFY-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: DWLFY-1.0.0-py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 50e158614c66ecc717a7a27b5e00782f022cea579c728c0871da49cda5b79321 |
|
MD5 | 8ef54d57727a7b51107def13c942dacd |
|
BLAKE2b-256 | 40e92c967c290f1dca4a7cd6700e69b5682fc399ea4ced72249557304e997df9 |