Saturday 29 October 2022

Download a youtube playlist

 Put ffmpeg.exe and yt-dlp (latest versions) to the folder where files to be downloaded.

The following command will download a playlist ${YOUR_PLAYLIST} in a subfolder with its reference name, enumerating the videos as they are ordered in the list, and assigning their names to the files. Numeration will start with 01 and with the oldest video. We need this to be able to keep the numeration later when we update the contents. The file archive.txt is needed to track the update and only download what hasn't been downloaded yet.

yt-dlp --format "bestvideo[height<=4k]+bestaudio/best" https://www.youtube.com/${YOUR_PLAYLIST} --embed-thumbnail --add-metadata --parse-metadata "description:(?s)(?P<webpage_url>.+)" --playlist-reverse --download-archive _archive --write-auto-sub --sub-langs "en,ru" -o "%%(playlist_index)s - %%(title)s - %%(id)s.%%(ext)s" --compat-option playlist-index