I had made a youtube video downloader using pytube in python. It previously works fine but during sometime it gives an error of "assets". I had tried a lot but I can't solve it. I had also tried to search error solution but I can't found anything like that.
Here is my code
def startDownload(url):
global file_size
path_to_save = askdirectory()
if path_to_save is None:
return
try:
global MaxFileSize, fileSizeInBytes
choice = youtubeChoicesLabel.get()
url=urlField.get()
yt = YouTube(url)
nome = yt.title
if (choice == download_choices[1]):
print("720p video is downloading")
selectVideo = yt.streams.filter(progressive=True, file_extension='mp4').first()
elif (choice == download_choices[2]):
print("144 video is downloading")
selectVideo = yt.streams.filter(progressive=True, file_extension='mp4').last()
selectVideo = yt.streams.filter(only_audio=True).first()
elif (choice == download_choices[0]):
return
fileSizeInBytes = selectVideo.filesize
MaxFileSize = fileSizeInBytes/1024000
MB =str(MaxFileSize)+ "MB"
print("File Size = : {:00.000f}".format (MaxFileSize))
st= selectVideo
yt.register_on_complete_callback(complete_download)
yt.register_on_progress_callback(progress_download)
file_size=st.filesize
st.download(output_path=path_to_save)
except Exception as e:
print(e)
download_choices = ["----Download Type----",
"Mp4 720p",
"Mp4 144p",
# "Video 3gp",
"Audio Mp3"]
def btnClicked():
try:
downloadBtn['text'] = "Please wait....."
downloadBtn["bg"] = "red"
downloadBtn["fg"] ="white"
downloadBtn['state']= 'disabled'
url=urlField.get()
if url == '':
showinfo("Message","Please input a url of the video.....")
return
print(url)
thread= Thread(target=startDownload,args=(url,))
thread.start()
except Exception as e:
print(e)
Here is my error
soham@LAPTOP-FJLV55TK MINGW64 ~
y"python "e:/python projects/YOUTUBE VIDEO DOWNLOADER/YOUTUBE_VIDEO_DOWNLOADER.py
e:/python projects/YOUTUBE VIDEO DOWNLOADER/YOUTUBE_VIDEO_DOWNLOADER.py
https://www.youtube.com/watch?v=rTuxUAuJRyY
'assets'