Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from pytube import YouTube as YT
- import subprocess
- from pytube.cli import on_progress
- import os
- import re
- def run():
- link = input("masukan donk alamat URL Video youtube:")
- yt = YT(link, on_progress_callback=on_progress)
- print("Judul: ",yt.title)
- print("Jumlah views: ",yt.views)
- #ambil yang paling akhir karena yang tertinggi
- ys = yt.streams.filter(only_audio=True)[-1]
- filename = yt.title
- filename = re.sub('[^A-Za-z0-9]+', ' ', filename)
- ys.download(filename=filename+".webm") #artinnya current location
- subprocess.run('ffmpeg -y -i "'+ filename+'.webm" "' + filename+'.mp3"',shell=True,capture_output=True)
- #hapus file *.webm nya
- os.remove(filename+".webm")
- print("Download selesai... {}".format(link))
- if __name__=='__main__':
- run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement