Skip to main content

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.

  1. 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.")
  1. 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.")
  1. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

DWLFY-1.0.1.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

DWLFY-1.0.1-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file DWLFY-1.0.1.tar.gz.

File metadata

  • Download URL: DWLFY-1.0.1.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for DWLFY-1.0.1.tar.gz
Algorithm Hash digest
SHA256 9dc07daab70b2fd7c017ffbea87f8cff5d6cb3dfc2c38387f61150b68b174ad1
MD5 ec4d2651fd918b8063e6d622d15a9723
BLAKE2b-256 1324b4121a19b8ca6f30d4fa41150f1a446c3deaf8c785135faffa9e330be991

See more details on using hashes here.

File details

Details for the file DWLFY-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: DWLFY-1.0.1-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

Hashes for DWLFY-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a347652b691c4d1972825e2c47913ed5333204b6959e5c653854da59346bd2a6
MD5 eed88e197f8171ac229f7c0bbb7864cb
BLAKE2b-256 c9425ac274581c4da5c5a9809dd03d202bfabb2a804de61ebf39736363a0310f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page