Skip to main content

An extension of yt-dlp targeting YoutubeDL with pydantic support.

Project description

yt-dlp-bonus

Python version License PyPi Latest release Black Downloads Total hits

This library does a simple yet the Lord's work; extends yt-dlp (YoutubeDL) and adds modelling support to the extracted YoutubeDL results using pydantic.

Installation

pip install yt-dlp-bonus -U

Usage

Search videos

from yt_dlp_bonus import YoutubeDLBonus

yt = YoutubeDLBonus()

search_results = yt.search_and_form_model(
    query="hello",
    limit=1
    )

print(search_results)

Download Video

from yt_dlp_bonus import YoutubeDLBonus, Downloader

video_url = "https://youtu.be/S3wsCRJVUyg"

yt_bonus = YoutubeDLBonus()

extracted_info = yt_bonus.extract_info_and_form_model(url=video_url)

downloader = Downloader(yt=yt_bonus)
downloader.ydl_run(
    extracted_info, video_format="bestvideo"
)

Download Audio

from yt_dlp_bonus import YoutubeDLBonus, Downloader

video_url = "https://youtu.be/S3wsCRJVUyg"

yt_bonus = YoutubeDLBonus()

extracted_info = yt_bonus.extract_info_and_form_model(url=video_url)

downloader = Downloader(yt=yt_bonus)

downloader.ydl_run(
    extracted_info, video_format=None, audio_format="bestaudio"
)

CLI

Download Video

Usage : $ yt-dlpb download-video <VIDEO-URL>

$ python -m yt_dlp_bonus download-video --help
                                                                                
 Usage: python -m yt_dlp_bonus download-video [OPTIONS] URL                     
                                                                                
 Download a youtube video                                                       
                                                                                
╭─ Arguments ──────────────────────────────────────────────────────────────────╮
│ *    url      TEXT  Link pointing to a Youtube video [default: None]         │
│                     [required]                                               │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ Options ────────────────────────────────────────────────────────────────────╮
│ --quality                        [144p|240p|360p|480p  Video quality to      │
│                                  |720p|1080p|2k|4k|8k  download              │
│                                  |best]                [default: best]       │
│ --dir                            DIRECTORY             Directory to save the │
│                                                        video to              │
│                                                        [default:             │
│                                                        /home/smartwa/git/sm… │
│ --format                         [webm|mp4]            Video format to       │
│                                                        process ie. mp4 or    │
│                                                        webm                  │
│                                                        [default: webm]       │
│ --quiet            --no-quiet                          Do not stdout         │
│                                                        anything              │
│                                                        [default: no-quiet]   │
│ --subtitle-lang                  TEXT                  Subtitle language to  │
│                                                        embed in the video    │
│                                                        [default: None]       │
│ --help                                                 Show this message and │
│                                                        exit.                 │
╰──────────────────────────────────────────────────────────────────────────────╯


Download Audio

Usage : $ yt-dlp download-audio <VIDEO-URL>

$ python -m yt_dlp_bonus download-audio --help
                                                                                
 Usage: python -m yt_dlp_bonus download-audio [OPTIONS] URL                     
                                                                                
 Download audio version of a YouTube video                                      
                                                                                
╭─ Arguments ──────────────────────────────────────────────────────────────────╮
│ *    url      TEXT  Link pointing to a Youtube video [default: None]         │
│                     [required]                                               │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ Options ────────────────────────────────────────────────────────────────────╮
│ --quality                  [ultralow|low|medium|be  Video quality to         │
│                            staudio]                 download                 │
│                                                     [default: bestaudio]     │
│ --dir                      DIRECTORY                Directory to save the    │
│                                                     video to                 │
│                                                     [default:                │
│                                                     /home/smartwa/git/smart… │
│ --format                   [webm|mp4]               Video format to process  │
│                                                     ie. mp4 or webm          │
│                                                     [default: webm]          │
│ --bitrate                  [64k|96k|128k|192k|256k  Audio bitrate while      │
│                            |320k]                   converting to mp3        │
│                                                     [default: None]          │
│ --quiet      --no-quiet                             Do not stdout anything   │
│                                                     [default: no-quiet]      │
│ --help                                              Show this message and    │
│                                                     exit.                    │
╰──────────────────────────────────────────────────────────────────────────────╯

$ python -m yt_dlp_bonus --help
                                                                                
 Usage: python -m yt_dlp_bonus [OPTIONS] COMMAND [ARGS]...                      
                                                                                
 Download Youtube videos in a number of formats.                                
                                                                                
╭─ Options ────────────────────────────────────────────────────────────────────╮
│ --install-completion          Install completion for the current shell.      │
│ --show-completion             Show completion for the current shell, to copy │
│                               it or customize the installation.              │
│ --help                        Show this message and exit.                    │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ───────────────────────────────────────────────────────────────────╮
│ download-video   Download a youtube video                                    │
│ download-audio   Download audio version of a YouTube video                   │
╰──────────────────────────────────────────────────────────────────────────────╯


[!NOTE] For more information on how to bypass bot detection then consider going through this Wiki.

License

The Unlicense

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

yt_dlp_bonus-0.2.8.tar.gz (21.7 kB view details)

Uploaded Source

Built Distribution

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

yt_dlp_bonus-0.2.8-py3-none-any.whl (19.3 kB view details)

Uploaded Python 3

File details

Details for the file yt_dlp_bonus-0.2.8.tar.gz.

File metadata

  • Download URL: yt_dlp_bonus-0.2.8.tar.gz
  • Upload date:
  • Size: 21.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Linux Mint","version":"22.3","id":"zena","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for yt_dlp_bonus-0.2.8.tar.gz
Algorithm Hash digest
SHA256 a0efe7aee3149bb27b729e40ac72dff0a18ff1461f58670aaece848e69c96096
MD5 f8b54f89411326967637f8af61e99306
BLAKE2b-256 95735da1766f7d37db189289a22c87c0091089d01b1e89282e3283ed817fb3a2

See more details on using hashes here.

File details

Details for the file yt_dlp_bonus-0.2.8-py3-none-any.whl.

File metadata

  • Download URL: yt_dlp_bonus-0.2.8-py3-none-any.whl
  • Upload date:
  • Size: 19.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Linux Mint","version":"22.3","id":"zena","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for yt_dlp_bonus-0.2.8-py3-none-any.whl
Algorithm Hash digest
SHA256 bcc15ac458f6f4acd9fe999106cecf8e11e944eb0241cd547a0ebef389f388a7
MD5 ee928e88a77ede6cfa137d39aa784a30
BLAKE2b-256 3d86c558912f39e8982054d1bbcc4f946418802b069ffccb2325596c70d4202b

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