Code:
from pytube import YouTube
try:
yt = YouTube('url')
a = yt.streams.filter(file_extension="mp4", res="720p").first() #this line is not working
a.download(filename='video.mp4')
except Exception as e:
bot.reply_to(message, f"Произошла ошибка: {str(e)}")
I get an exception: Error: HTTP Error 400: Bad Request
I tried uninstalling and installing Pytube again, changed the syntax several times, but nothing worked. I don’t know what this is related to. (Python Version 3.11, I tried 3.12 too)
New contributor
Sqwer is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.