Download multiple videos with youtube-dl

20 Dec 2020 in TIL

This post has been updated to use yt-dlp rather than youtube-dl

I've been building up a list of conference talks to watch in a text file on my desktop for a while now, and wanted to sync them to my phone to watch when I'm away from my desk.

yt-dlp is a fantastic tool for archiving media and it turns out that it supports downloading multiple files at once with the --batch-file option.

To use this, create a new file named batch.txt with the URLs that you want to fetch, with one URL per line. Next, run yt-dlp -c -o "%(title)s.%(ext)s" --batch-file=batch.txt -f "[ext=mp4][height=720]". The -c tells youtube-dl to resume any partially downloaded files and the -o flag sets the output filename to be the title of the video. The -f option tells yt-dlp to download 720p mp4 files.