Skip to content

Instantly share code, notes, and snippets.

@xjcoan
Last active February 10, 2022 14:47
Show Gist options
  • Select an option

  • Save xjcoan/d233d791965d162059d505f67fc6845c to your computer and use it in GitHub Desktop.

Select an option

Save xjcoan/d233d791965d162059d505f67fc6845c to your computer and use it in GitHub Desktop.
pytube download videos from playlist
from pytube import Playlist
from pytube import YouTube
import re
def download_vids():
playlist = Playlist("PLAYLISTURL")
playlist._video_regex = re.compile(r"\"url\":\"(/watch\?v=[\w-]*)")
for url in playlist:
print(url)
yt = YouTube(url)
yt.streams[0].download()
download_vids()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment