Advertisement
paperline27

Vidio YouTube Downloader

Sep 27th, 2023
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. from pytube import YouTube as YT
  2. import subprocess
  3. from pytube.cli import on_progress
  4. import os
  5. import re
  6. def run():
  7. link = input("masukan donk alamat URL Video youtube:")
  8. yt = YT(link, on_progress_callback=on_progress)
  9. print("Judul: ",yt.title)
  10. print("Jumlah views: ",yt.views)
  11.  
  12. #ambil yang paling akhir karena yang tertinggi
  13. ys = yt.streams.filter(only_audio=True)[-1]
  14.  
  15. filename = yt.title
  16. filename = re.sub('[^A-Za-z0-9]+', ' ', filename)
  17.  
  18. ys.download(filename=filename+".webm") #artinnya current location
  19. subprocess.run('ffmpeg -y -i "'+ filename+'.webm" "' + filename+'.mp3"',shell=True,capture_output=True)
  20. #hapus file *.webm nya
  21. os.remove(filename+".webm")
  22. print("Download selesai... {}".format(link))
  23. if __name__=='__main__':
  24. run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement