YouTube command-line download tool

Example

❯ yt-dlp -t mp3 https://www.youtube.com/watch\?v\=CB57GYkTSfA
[youtube] Extracting URL: https://www.youtube.com/watch?v=CB57GYkTSfA
[youtube] CB57GYkTSfA: Downloading webpage
WARNING: [youtube] No supported JavaScript runtime could be found. Only deno is enabled by default; to use another runtime, add --js-runtimes RUNTIME[:PATH] to your command/config. YouTube extraction without a JS runtime has been deprecated, and some formats may be missing. See https://github.com/yt-dlp/yt-dlp/wiki/EJS for details on installing one.
[youtube] CB57GYkTSfA: Downloading android vr player API JSON
[info] CB57GYkTSfA: Downloading 1 format(s): 251
[download] OneRepublic - I Lived (Audio) [CB57GYkTSfA].webm has already been downloaded
[download] 100% of    1.44MiB
[ExtractAudio] Destination: OneRepublic - I Lived (Audio) [CB57GYkTSfA].mp3
Deleting original file OneRepublic - I Lived (Audio) [CB57GYkTSfA].webm (use -k to keep)

Official Website

Installation

Install via pip:

pip install yt-dlp

For installation via other methods, see GitHub - yt-dlp/yt-dlp: A feature-rich command-line audio/video downloader · GitHub.

Usage

Note: ffmpeg must be installed before using yt-dlp.
The most common and straightforward usage options:

# Download the audio of the specified video link in MP3 format
yt-dlp -t mp3 https://www.youtube.com/watch?v=CB57GYkTSfA

# Download the video of the specified video link in MP4 format
yt-dlp -t mp4 https://www.youtube.com/watch?v=CB57GYkTSfA

For more options, run:

yt-dlp -h