Skip to content

Instantly share code, notes, and snippets.

@FelipeSBarros
Created February 23, 2022 17:58
Show Gist options
  • Save FelipeSBarros/d1bfe745d154cd1bb3272cf0549f99bb to your computer and use it in GitHub Desktop.
Save FelipeSBarros/d1bfe745d154cd1bb3272cf0549f99bb to your computer and use it in GitHub Desktop.
from re import sub
from pytube import Playlist
# where to save
SAVE_PATH = "./"
# link of the playlist to be downloaded
p = Playlist("https://www.youtube.com/playlist?list=PLqa06jy1NEM3PI3eQGemUgEmKS5oHAw7B")
for video in p.videos:
try:
# downloading the video
print(f'Downloading: {video.title}')
talk = video.streams \
.filter(progressive=True,
file_extension='mp4') \
.order_by('resolution') \
.desc() \
.first()
talk_name = sub(pattern='FOSS4G -', repl='FOSS4G 2021 -', string=talk.title)
talk.download(filename=talk_name) # output_path=SAVE_PATH)
except:
print(f'Error in: {video.title}')
print('Task Completed!')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment