Skip to content

Instantly share code, notes, and snippets.

@DiegoFleitas
Last active January 17, 2024 01:53
Show Gist options
  • Save DiegoFleitas/c940d4b94d6b92b55a7084afe84bf571 to your computer and use it in GitHub Desktop.
Save DiegoFleitas/c940d4b94d6b92b55a7084afe84bf571 to your computer and use it in GitHub Desktop.
youtube-dl (yt-dlp) useful commands
# download first 31 videos from playlist as mp3 ignoring errors
ty-dlp -i --playlist-start 31 --extract-audio --audio-format mp3 -o "%(title)s.%(ext)s" "https://www.youtube.com/playlist?list=PLzIUZKHPb1HbRFdPjNMxsnwngP27R5rk6"
# download first 3 videos from playlist ignoring errors
ty-dlp -i --playlist-end 3 -o "%(title)s.%(ext)s" "https://www.youtube.com/playlist?list=PLzIUZKHPb1HbRFdPjNMxsnwngP27R5rk6"
# backup channel
ty-dlp -f bestvmuideo+bestaudio/best --download-archive archive.txt --merge-output-format mkv -i --all-subs --embed-subs --add-metadata --write-annotations --write-info-json --write-thumbnail --write-description -o "%(uploader)s/%(title)s %(id)s.%(ext)s" --yes-playlist https://www.youtube.com/channel/UCh7zWwSV3xPPzxViCbjJnaQ
# list playlist videos data as json
ty-dlp -j --flat-playlist "https://www.youtube.com/watch?v=YM2NQgIG-QM&list=PLzIUZKHPb1HbRFdPjNMxsnwngP27R5rk6" > playlist.log
# backup whole playlist stopping on error
ty-dlp -o "%(title)s.%(ext)s" "https://www.youtube.com/watch?v=YM2NQgIG-QM&list=PLzIUZKHPb1HbRFdPjNMxsnwngP27R5rk6"
# list playlist videos data as json then convert to csv & save on file
ty-dlp -j --flat-playlist "https://www.youtube.com/watch?v=YM2NQgIG-QM&list=PLzIUZKHPb1HbRFdPjNMxsnwngP27R5rk6" | jq -r "[.id,.title] | @csv" > TEST.csv
# list playlist videos data as json then convert to csv from index 267 & save on file
ty-dlp -j --flat-playlist --playlist-start 267 "https://www.youtube.com/watch?v=YM2NQgIG-QM&list=PLzIUZKHPb1HbRFdPjNMxsnwngP27R5rk6" | jq -r "[.id,.title] | @csv" > TEST.csv
# get thumbnails
ty-dlp -i --no-warnings --get-thumbnail "https://www.youtube.com/watch?v=YM2NQgIG-QM&list=PLzIUZKHPb1HbRFdPjNMxsnwngP27R5rk6" | wget --no-check-certificate -i -
# wget save link as image1.jpg
wget --no-check-certificate -O image1.jpg https://i.ytimg.com/vi/R6LTkbIpbE4/maxresdefault.jpg
# wget save on youtube id directory
wget --no-check-certificate -x -nH --cut-dirs 1 https://i.ytimg.com/vi/R6LTkbIpbE4/maxresdefault.jpg
# save thumbnails on directories with video id
ty-dlp -i --no-warnings --get-thumbnail "https://www.youtube.com/watch?v=YM2NQgIG-QM&list=PLzIUZKHPb1HbRFdPjNMxsnwngP27R5rk6" | wget --no-check-certificate -x -nH --cut-dirs 1 -i -
# save thumbnails from playlist on directories with video id
ty-dlp -i --playlist-start 250 --no-warnings --get-thumbnail "https://www.youtube.com/watch?v=YM2NQgIG-QM&list=PLzIUZKHPb1HbRFdPjNMxsnwngP27R5rk6" | wget --no-check-certificate -x -nH --cut-dirs 1 -i -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment