Skip to main content

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:

  1. Download MP3 with Best Audio Quality:

    apdl -url https://youtu.be/qWEhlE7NVi0 -mp3
    
  2. Download MP3 with Specific Quality (e.g., 128kbps):

    apdl -url https://youtu.be/qWEhlE7NVi0 -mp3 128
    
  3. Download MP4 with Best Video Quality:

    apdl -url https://youtu.be/qWEhlE7NVi0 -mp4
    
  4. Download MP4 with Specific Resolution (e.g., 360p):

    apdl -url https://youtu.be/qWEhlE7NVi0 -mp4 360
    
  5. Download Thumbnail:

    apdl -url https://youtu.be/qWEhlE7NVi0 -thumbnail
    
  6. Get Video Title:

    apdl -url https://youtu.be/qWEhlE7NVi0 -title
    
  7. 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:

  1. Setup:

    • The script starts by importing the YouTube class from the apdl module and defining the video URL.
  2. Fetching Video Info:

    • The script retrieves video details like title and thumbnail by calling youtube.fetch_video_info().
  3. Downloading:

    • Depending on the desired format (mp3 or mp4), 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.

Notes:

  • Make sure to install the necessary dependencies (requests, fake_useragent, etc.).
  • The quality parameter for mp3 can be set to values like 64, 128, 192, 256, 320 kbps.
  • The quality for mp4 can be set to resolutions like 360, 480, 720, 1080 p.

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

apdl-0.0.0.0.0.3.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

apdl-0.0.0.0.0.3-py2.py3-none-any.whl (8.4 kB view details)

Uploaded Python 2Python 3

File details

Details for the file apdl-0.0.0.0.0.3.tar.gz.

File metadata

  • Download URL: apdl-0.0.0.0.0.3.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.3

File hashes

Hashes for apdl-0.0.0.0.0.3.tar.gz
Algorithm Hash digest
SHA256 b583a9d89c1dac708dda85cf58908ab6723549cc5035f36c1bc8689621564dfd
MD5 bb10f25b6fac6acad53b1866ad994687
BLAKE2b-256 a35992bce33de4fa912fffce6aa06e214e18bf83b0c1fe8c6c1638216d3515bd

See more details on using hashes here.

File details

Details for the file apdl-0.0.0.0.0.3-py2.py3-none-any.whl.

File metadata

  • Download URL: apdl-0.0.0.0.0.3-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

Hashes for apdl-0.0.0.0.0.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 d3833cdea6f753f9783e2175aa5da1258f7bda0b53124c336624d50d423a40f2
MD5 3d668426440832590f49d09d33214ced
BLAKE2b-256 072fe972964848a1035527b8f78eda226d3cee30c73fb77562d6051a5a2d83c3

See more details on using hashes here.

Supported by

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