Hello, does anyone know what I did wrong? Or why my video is downloaded in mp4 but NOT in mp3?
def converter(request):
if request.method == 'POST':
link = request.POST['link']
video = YouTube(link)
format = request.POST['format']
if format == "3":
stream = video.streams.get_audio_only()
download_folder = os.path.expanduser("~")+"/Downloads/"
stream.download(download_folder)
os.rename(stream.download + ".mp3")
elif format == "4":
stream = video.streams.get_highest_resolution()
download_folder = os.path.expanduser("~")+"/Downloads/"
stream.download(download_folder)
return render(request, 'home/videoconverter.html',)
Aucun commentaire:
Enregistrer un commentaire