Return to Homepage

Return to Notes list

2024-03-17

Using yt-dlp

Installing yt-dlp

pipx install yt-dlp

Batch Downloads

First, grab all of a channels video urls and put them in a text file

yt-dlp --flat-playlist --print-to-file "%(url)s #  %(title)s" channel.txt \
https://www.youtube.com/channel/XXXX

Then use the batch-download feature to download them all. yt-dlp grabs the best available audio and video quality combination by default

yt-dlp --batch-file ./channel.txt

For music, use the following to strip out the audio to seperate files:

for i in *.webm; do ffmpeg -i "$i" -vn -acodec mp3 "${i%.*}.mp3"; done

Get an entire audio playlist

yt-dlp --write-thumbnail --verbose -f bestaudio --extract-audio --audio-format mp3 \
--audio-quality 320k https://www.youtube.com/playlist?list=XXX