Download a YouTube playlist with youtube-dl

What is it?

This batch script will save all the videos of a YouTube playlist in the same folder as the batch script, together with the video thumbnail (jpg), the metadata info (.info.json), the annotations (.annotations.xml) and subtitles (if there are any).

Requirements

You need Python 3, youtube-dl for python and a youtube playlist.

How to use

Just save the following code as a batch script (that is .bat or .cmd). Edit the https://www.youtube.com/playlist?list=XXXXXXXXXXXZz8toIkm3-ehTuqeXXXXXXX code to the link of your playlist, save and run the batch file.

Note that this will upgrade PIP and youtube-dl because YouTube API changes all the time so better keep up with the changes.

@echo off
set videolink="https://www.youtube.com/playlist?list=XXXXXXXXXXXZz8toIkm3-ehTuqeXXXXXXX"

title Youtube-dl %videolink%
color E0
pushd %~dp0
cd /d %~dp0
echo Directory: %~dp0

start /w python.exe -m pip install --upgrade pip
start /w python.exe -m pip install --upgrade youtube-dl

youtube-dl ^
--download-archive list.txt ^
--write-info-json ^
--write-annotations ^
--write-thumbnail ^
--write-all-thumbnails ^
--write-sub ^
--all-subs ^
--embed-thumbnail ^
--convert-subs srt ^
--console-title ^
--ignore-errors ^
--output "%%(playlist_title)s\%%(playlist_index)s - %%(title)s.%%(ext)s" ^
"%videolink%"

Why do you need it?

Stuff disappears from YouTube all the time. Nothing sucks more than visiting one of your playlists and half of the videos are deleted/removed. With this script, you never have to worry again. Unleash the hoarder inside! 😂 Even set it up as a scheduled task if you need to.

Leave a Reply

Your email address will not be published. Required fields are marked *