The youtube-dl documentation is great, but it’s hard to use as a quick reference.

This is my quick reference. I hope you find it useful.

Full documentation is in the official Github repo: https://github.com/ytdl-org/youtube-dl/blob/master/README.md

Why use youtube-dl?

Because you love certain videos, and you want to watch them later. Without youtube-dl and proper backups, safety is not guaranteed.

youtube-dl works on a large selection of video sites, not just YouTube. If in doubt, just try it. It will probably work.

That last paragraph is mere hearsay, but I believe in the open source community.

Most useful flags

-x, --extract-audio
-i, --ignore-errors
--no-playlist

Failure handling

YouTube videos often go missing. Playlists containing blocked, deleted, and private videos are very common.

By default, youtube-dl will halt if it encounters an error. This can be helpful if you’re archiving content and want to ensure 100% archival.

Most of the time, I use the -i flag to ignore errors.

Common scenarios

url can be a single video url or a playlist url, e.g.
https://www.youtube.com/watch?v=vNwYtllyt3Q
https://www.youtube.com/watch?v=vNwYtllyt3Q&list=RDvNwYtllyt3Q

# Download a video/playlist, ignoring errors:
youtube-dl -i url

# Download a video/playlist, halting on errors:
youtube-dl url

# Download a video/playlist, keeping only the audio files and ignoring errors:
youtube-dl -xi url

# Download just the current video as an audio file, ignoring the rest of the playlist:
youtube-dl -x --no-playlist url