Download videos from YouTube
yt-dlp is a small command-line program to download videos from YouTube.com and few more sites. It is frequently updated. To make sure it is up to date, open use Windows Powershell and navigate to the directory with the python files cd "C:\BHL\Utilities\youtube-dl\". Run the following command: ./yt-dlp.exe --update
You can optionally open the Documentation to see all of the options you can use while running yt-dlp.
Using Configuration File and Batch File
Find the video(s) on YouTube that you would like to capture. It should have a URL that looks something like this: http://www.youtube.com/watch?v=[ALPHANUMERIC CHARACTERS]
Create a batch-file.txt file with one URL on each line and save it in the directory where you want to save the videos.
Edit the CONFIG.TXT file in "C:\BHL\Utilities\youtube-dl" with the following information*:
Change the --batch-file file path to the file you created in the previous step.
Change the --paths (output directory location) to where you'd like to save the downloaded files.
Be sure to retain --output %(title)s.%(ext)s. This will append the video title to the download.
Run the following command: .\yt-dlp.exe --config-location "C:\BHL\Utilities\youtube-dl\config.txt"
This will:
write video metadata to a .info.json file;
write video description to a .description file;
write thumbnail image to disk;
write video annotations to a .annotations.xml file;
download all available subtitles for the video; and
download video from YouTube.
*If the CONFIG.TXT file is missing please see Yt-DLP Config file setup to create a new file.
Capturing an individual video
Find the video on YouTube that you would like to capture. It should have a URL that looks something like this: http://www.youtube.com/watch?v=[ALPHANUMERIC CHARACTERS]
Open Command Prompt and use the cd command (or cd /d if the path is on a different drive) to navigate to the directory where you want to save the videos. Be sure to enclose the path in quotation marks if there are any spaces.
Run the following command: "C:\BHL\Utilities\youtube-dl\yt-dlp.exe" -o "%(title)s/%(title)s-%(id)s.%(ext)s" --write-info-json --write-description --write-thumbnail --write-annotations --all-subs -f bestvideo+bestaudio URL
This will:
write video metadata to a .info.json file;
write video description to a .description file;
write thumbnail image to disk;
write video annotations to a .annotations.xml file;
download all available subtitles for the video; and
download video from YouTube.
Capturing a playlist
Find the playlist on YouTube that you would like to capture. It should have a URL that looks something like this: http://www.youtube.com/playlist?list=[ALPHANUMERIC CHARACTERS] (all individual videos in the playlist will share the same alphanumeric characters that identify the playlist)
Open Command Prompt and use the cd command (or cd /d if the path is on a different drive) to navigate to the directory where you want to save the videos. Be sure to enclose the path in quotation marks if there are any spaces.
Run the following command: "C:\BHL\Utilities\youtube-dl\yt-dlp.exe" --write-info-json --write-description --write-thumbnail --write-annotations --all-subs -f bestvideo+bestaudio URL
For each video in the playlist, this will:
write video metadata to a .info.json file;
write video description to a .description file;
write thumbnail image to disk;
write video annotations to a .annotations.xml file;
download all available subtitles for the video; and
download video from YouTube.
Capturing multiple videos
Find the videos on YouTube that you would like to capture. They should have URLs that looks something like this: hhttp://www.youtube.com/watch?v=[ALPHANUMERIC CHARACTERS]
Create a .TXT file with one URL on each line and save it in in the directory where you want to save the videos.
Open Command Prompt and use the cd command (or cd /d if the path is on a different drive) to navigate to the directory where you want to save the videos. Be sure to enclose the path in quotation marks if there are any spaces.
Run the following command: "C:\BHL\Utilities\youtube-dl\yt-dlp.exe" --write-info-json --write-description --write-thumbnail --write-annotations --all-subs -f bestvideo+bestaudio --batch-file FILE
For each video in the file containing URLs to download, this will:
write video metadata to a .info.json file;
write video description to a .description file;
write thumbnail image to disk;
write video annotations to a .annotations.xml file;
download all available subtitles for the video; and
download video from YouTube.