Advertisement
paster442

YouTube Video Downloader (Python)

Aug 27th, 2021 (edited)
123
-1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.56 KB | None | 0 1
  1. from youtube_dl import YoutubeDL as yt
  2.  
  3. def download(link):
  4.     ydl_opts = {"outtmpl": "C:\\Users\\HP\\Downloads\\vids\\%(title)s.%(ext)s", "quiet": True}
  5.  
  6.     with yt(ydl_opts) as ydl:
  7.         ydl.download([str(link)])
  8.  
  9.  
  10. videos = list()
  11. video = ""
  12. while video.lower() != "c":
  13.     video = input("Paste link here (enter \"c\" to exit): ")
  14.     videos.append(video)
  15.  
  16. try:
  17.     videos.remove("c")
  18. except:
  19.     videos.remove("C")
  20.  
  21. print()
  22. for link in videos:
  23.    try:
  24.     download(link)
  25.     print("Downloaded " + link)
  26.    except:
  27.     print("Failed to download " + link)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement