Skip to main content
  1. Posts/

Download YouTube (or any) videos with yt-dlp

424 words·2 mins
Useful FOSS
Installations>

Installations #

Linux and Mac>

Linux and Mac #

For the Linux elitists and Apple users, you can use the command line and install it with your package manager. I.e. sudo apt install yt-dlp

You can also download the lastest release for your OS.

Windows>

Windows #

Windows users can also download the yt-dlp.exe release file.

Or better yet, ditch the old way of downloading anything and use tools like Chocolatey (learn more about Chocolatey from my previoius post)

choco install yt-dlp
Update>

Update #

If you need the latest version of yt-dlp (E.g. stable release distro user), you can get the lastest version of yt-dlp by downloading the latest release file or run:

yt-dlp --update
Usage>

Usage #

Basic: Downloading a video>

Basic: Downloading a video #

yt-dlp "LINK"
# Example
yt-dlp "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
Always put quotes to wrap around your link to avoid errors.
Common Usage>

Common Usage #

Command Function
yt-dlp --yes-playlist "LINK" Download a playlist of videos
yt-dlp --extract-audio "LINK" Download only the audio
yt-dlp --extract-audio --yes-playlist "LINK" Download a playlist of audios
yt-dlp --extract-audio --yes-playlist -o "%(playlist_index)s-%(title)s.%(ext)s" "LINK" Download a playlist of audios with filename in the pattern of “01-filename.mp3”
Useful Options>

Useful Options #

Option Function
--ignore-errors Not interrupting the download when encountered errors
--recode-video mkv Change the format of your downloaded video/audio (mkv here) (require ffmpeg)
--geo-bypass Bypass geographic restrictions
--playlist-items 4-20 Only download certain videos from a playlist (4th to 20th here)
Numbered playlist download>

Numbered playlist download #

yt-dlp -o "%(playlist_index)s-%(title)s.%(ext)s" "LINK"

This command will download and output your file as ordered in the playlist. Credit to Iman Mohamadi

Need help?>

Need help? #

How do I know all these options? Remember the manual is your friend. Hence, people often says RTFM, they just reminding you to Read That Friendly Manual. If you need any help, try the manual first before searching them online.

yt-dlp --help
Background>

Background #

yt-dlp is a fork of youtube-dl, which is a popular YouTube video downloader in the command line. You can think of yt-dlp as the enhanced version of her predecessor.

Despite the name, they are used to download videos from all kinds of websites. Use list-extractors to know which platform is supported.

Why yt-dlp over youtube-dl?>

Why yt-dlp over youtube-dl? #

youtube-dl can be very slow and a lot of times, painfully so.

Most of the time I get less than 100Kb/s when using it. With yt-dlp, in the same environment and WiFi network, I get at least a few Mb/s. The difference is night and day.