Skip to content

Instantly share code, notes, and snippets.

@YiLi225
Last active February 26, 2023 15:47
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 YiLi225/35248ecdea0da463923f3213cd267a1d to your computer and use it in GitHub Desktop.
Save YiLi225/35248ecdea0da463923f3213cd267a1d to your computer and use it in GitHub Desktop.
from pytube import YouTube
def DownloadYT(url):
youtubeObject = YouTube(url)
youtubeObject = youtubeObject.streams.get_highest_resolution()
try:
youtubeObject.download()
print("Title:", youtubeObject.title)
print("=== Download is completed successfully ===\n")
except:
print("An error has occurred")
urls = ['https://www.youtube.com/shorts/EqTi6ysLd80',
'https://www.youtube.com/shorts/SnPD7jK3HHc']
for url in urls:
DownloadYT(url)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment