Skip to content

Instantly share code, notes, and snippets.

@sagax
Created May 5, 2018 01:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sagax/5fe39825ead21e7f04028fc0b51150a0 to your computer and use it in GitHub Desktop.
Save sagax/5fe39825ead21e7f04028fc0b51150a0 to your computer and use it in GitHub Desktop.
youtube playlist downloader with youtube-dl
#!/bin/bash
# how to use
# youtubeplaylistdownload.sh link_to_playlist format_to_download
# example
# youtubeplaylistdownload.sh PL5zohYERz9XAYqBu0HQJ_tudt2R6gbPtb 171
#
for url in $(curl -s -X GET https://www.youtube.com/playlist?list="$1" | awk '/data-video-id=/{match($0, /data-video-id="([^"]*)/, arr); print("https://www.youtube.com/watch?v="arr[1]);}'); do
youtube-dl -f "$2" $url
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment