I get a 'streams has no endswith attribute'
# Download function MP3
def download():
try:
mp3_file = "audio.mp3"
url = YouTube(str(link.get()))
video = url.streams.first()
VideoClip = VideoFileClip(video)
audioclip = VideoClip.audio
audioclip.write_audiofile(mp3_file)
audioclip.close()
VideoClip.close()
mp3_file.download(Path.home() / "Downloads")
Label(root, text = "Downloaded",).place(relx = .5, rely = .6, anchor = CENTER)
link_enter.delete(0,END)
except AttributeError:
print("No")
What's supposed to happen is I click a button and the mp4 is converted to mp3 and downloaded, but I get the AttributeError