Skip to content

Instantly share code, notes, and snippets.

@dmfunk
Last active May 23, 2020 11:52
Show Gist options
  • Save dmfunk/e176bcff7d76a56f2073 to your computer and use it in GitHub Desktop.
Save dmfunk/e176bcff7d76a56f2073 to your computer and use it in GitHub Desktop.
import pafy
playlist_url = raw_input("Please enter a proper Youtube playlist URL: ") #must be properly formatted like https://www.youtube.com/playlist?list=PL557BC4AF6ABFF637
playlist = pafy.get_playlist(playlist_url)
how_many_vids_in_this_playlist = len(playlist['items']) #long variables are fun
print "Thanks for the URL, I'm now going to download", how_many_vids_in_this_playlist, "videos"
for videos in playlist['items']:
target = videos['pafy'].getbestaudio()
print "Currently downloading", videos['playlist_meta']['title'] #might as well see the name of each track as it downloads
# it would be nice to have a progress indicator, like x of total finished downloading
#I'll leave that part up to you :)
target.download()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment