apdl - A Python package for downloading YouTube videos in MP3 and MP4 formats.
Project description
apdl - YouTube Downloader
apdl is a Python module to download YouTube videos as MP3 or MP4 files. You can specify the quality or resolution of the download and also retrieve video details such as title and thumbnail.
Installation
To install the module, you can use pip:
pip install apdl
Command-Line Usage
Once the module is installed, you can use it directly from the command line.
Syntax:
apdl -url <youtube_url> -mp3 [<quality>] # For MP3 downloads
apdl -url <youtube_url> -mp4 [<resolution>] # For MP4 downloads
apdl -url <youtube_url> -thumbnail # For thumbnail download
apdl -url <youtube_url> -title # For video title
apdl -url <youtube_url> -list # For display the quality of MP3 and MP4
Examples:
-
Download MP3 with Best Audio Quality:
apdl -url https://youtu.be/qWEhlE7NVi0 -mp3
-
Download MP3 with Specific Quality (e.g., 128kbps):
apdl -url https://youtu.be/qWEhlE7NVi0 -mp3 128
-
Download MP4 with Best Video Quality:
apdl -url https://youtu.be/qWEhlE7NVi0 -mp4
-
Download MP4 with Specific Resolution (e.g., 360p):
apdl -url https://youtu.be/qWEhlE7NVi0 -mp4 360
-
Download Thumbnail:
apdl -url https://youtu.be/qWEhlE7NVi0 -thumbnail
-
Get Video Title:
apdl -url https://youtu.be/qWEhlE7NVi0 -title
-
Help Command:
apdl -help
This will display the usage instructions.
Python Script Usage
You can also use the apdl module directly in a Python script to download YouTube videos, retrieve their information, and choose the quality/resolution for the download.
Example Script:
# Import the required functions from apdl
from apdl import fetch_video_info, thumbnail_mode, mp3_mode, mp4_mode
# URL of the YouTube video to be processed
url = "https://youtu.be/ztYDA38JLGM" # Replace with the actual YouTube video URL
# Define the desired format and quality
format_type = "mp3" # Options: "mp3" or "mp4"
quality = "128" # For mp3: 64, 128, 192, 256, 320 kbps; For mp4: 360, 480, 720, 1080
try:
# Fetching video information (e.g., title, available qualities, etc.)
video_info, auth = fetch_video_info(url)
print(f"Video Title: {video_info.get('title', 'Unknown')}")
# Display the video thumbnail
print("Displaying video thumbnail...")
thumbnail_mode(url)
# Downloading MP3 in the specified quality (e.g., 128kbps)
if format_type == "mp3":
print(f"Downloading MP3 in {quality}kbps quality...")
mp3_mode(video_info, auth, quality=quality)
# Downloading MP4 in the specified quality (e.g., 720p)
elif format_type == "mp4":
print(f"Downloading MP4 in {quality} quality...")
mp4_mode(video_info, auth, quality=quality)
except Exception as e:
# Handling any potential errors that might occur during the process
print(f"An error occurred: {e}")
Explanation:
-
Setup:
- The script starts by importing the
YouTubeclass from theapdlmodule and defining the video URL.
- The script starts by importing the
-
Fetching Video Info:
- The script retrieves video details like title and thumbnail by calling
youtube.fetch_video_info().
- The script retrieves video details like title and thumbnail by calling
-
Downloading:
- Depending on the desired format (
mp3ormp4), it starts the conversion with the chosen quality and monitors the conversion process. - Once the conversion is completed, the file is downloaded and saved with the title of the video and the format/quality in the filename.
- Depending on the desired format (
Notes:
- Make sure to install the necessary dependencies (
requests,fake_useragent, etc.). - The
qualityparameter formp3can be set to values like64,128,192,256,320kbps. - The
qualityformp4can be set to resolutions like360,480,720,1080p.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file apdl-0.0.0.0.0.2.tar.gz.
File metadata
- Download URL: apdl-0.0.0.0.0.2.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.32.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
044cbaf5f6992ba4dfed74eb291ad03155dbfe8c594444ae459dd1501cecaeae
|
|
| MD5 |
2cbdf573d785cbd82aad856cbf993f0e
|
|
| BLAKE2b-256 |
9d1fe75440fb5b9059be02b362b87519ca8d5e73b1798c493c4fe03617c6368e
|
File details
Details for the file apdl-0.0.0.0.0.2-py2.py3-none-any.whl.
File metadata
- Download URL: apdl-0.0.0.0.0.2-py2.py3-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.32.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f5e669eb1299c1b980d1c4d5e5aa48d9e34020f106ebe57cfe2d0ed2d009372e
|
|
| MD5 |
46669422efaa7e137b6dcf6c9dac8477
|
|
| BLAKE2b-256 |
8dec282c396e0e8cc81bee75f0be3cc679fc93246262fb27a8180848215e56c1
|