Advertisement
Najeebsk

YT-DOWNLOAD.py

Feb 27th, 2024
931
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.19 KB | None | 0 0
  1. '''
  2. Requirements- python 3.8 or above
  3. pip install pyautogui
  4. pip install pytube
  5. pip install colorama
  6. '''
  7. from time import sleep
  8. import pyautogui as pg
  9. from pytube import YouTube
  10. from colorama import Fore
  11.  
  12. ask='YES'
  13. while ask=='YES':
  14.     ytUrl=pg.prompt('Enter Youtube video URL which you want to download',title='YT URL')
  15.     ytDownLoc=pg.prompt('Where do you want to download this video:',title='FILE LOCATION',default=(r".\Najeeb_Yt_downloaded_videos")) ##FILE LOCATION
  16.     setRes=pg.confirm('Set resolution of the video pixels',title='VIDEO RESOLUTION',buttons=['Lowest','Max','Get Audio'])
  17.  
  18. ##main code-
  19.     yt = YouTube(str(ytUrl))
  20.     print(Fore.RED+"Title: ", Fore.YELLOW+yt.title)
  21.     sleep(2)
  22.     print(Fore.GREEN+"Views: ",Fore.RED+str(yt.views)+Fore.RESET)
  23.  
  24.     if setRes=='Max':
  25.          yd = yt.streams.get_highest_resolution()
  26.     if setRes=='Lowest':
  27.          yd = yt.streams.get_lowest_resolution()
  28.     if setRes=='Get Audio':
  29.          yd = yt.streams.get_audio_only()
  30.  
  31.     yd.download(str(ytDownLoc))
  32.  
  33.     tell=pg.alert('DOWNLOAD DONE',title='DOWNLOAD COMPLETE')
  34.     print('DONE')
  35.     ask=pg.confirm('Want to do again?',title='TRY AGAIN',buttons=["YES","NO"])
  36.  
  37.  
  38.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement