ошибка:
Traceback (most recent call last):
File "C:\Users\Ярослав\OneDrive\Рабочий стол\main.py", line 7, in <module>
yt.streams.get_highest_resolution().download()
File "C:\Users\Ярослав\AppData\Local\Programs\Python\Python312\Lib\site-packages\pytube\__main__.py", line 296, in streams
return StreamQuery(self.fmt_streams)
File "C:\Users\Ярослав\AppData\Local\Programs\Python\Python312\Lib\site-packages\pytube\__main__.py", line 176, in fmt_streams
stream_manifest = extract.apply_descrambler(self.streaming_data)
File "C:\Users\Ярослав\AppData\Local\Programs\Python\Python312\Lib\site-packages\pytube\__main__.py", line 160, in streaming_data
self.bypass_age_gate()
File "C:\Users\Ярослав\AppData\Local\Programs\Python\Python312\Lib\site-packages\pytube\__main__.py", line 257, in bypass_age_gate
innertube_response = innertube.player(self.video_id)
File "C:\Users\Ярослав\AppData\Local\Programs\Python\Python312\Lib\site-packages\pytube\innertube.py", line 448, in player
return self._call_api(endpoint, query, self.base_data)
File "C:\Users\Ярослав\AppData\Local\Programs\Python\Python312\Lib\site-packages\pytube\innertube.py", line 390, in _call_api
response = request._execute_request(
File "C:\Users\Ярослав\AppData\Local\Programs\Python\Python312\Lib\site-packages\pytube\request.py", line 37, in _execute_request
return urlopen(request, timeout=timeout) # nosec
File "C:\Users\Ярослав\AppData\Local\Programs\Python\Python312\Lib\urllib\request.py", line 215, in urlopen
return opener.open(url, data, timeout)
File "C:\Users\Ярослав\AppData\Local\Programs\Python\Python312\Lib\urllib\request.py", line 521, in open
response = meth(req, response)
File "C:\Users\Ярослав\AppData\Local\Programs\Python\Python312\Lib\urllib\request.py", line 630, in http_response
response = self.parent.error(
File "C:\Users\Ярослав\AppData\Local\Programs\Python\Python312\Lib\urllib\request.py", line 559, in error
return self._call_chain(*args)
File "C:\Users\Ярослав\AppData\Local\Programs\Python\Python312\Lib\urllib\request.py", line 492, in _call_chain
result = func(*args)
File "C:\Users\Ярослав\AppData\Local\Programs\Python\Python312\Lib\urllib\request.py", line 639, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 400: Bad Request
код:
from pytube import YouTube
link = 'https://www.youtube.com/watch?v=U4jVQ9QFQXI'
yt = YouTube(link)
yt.streams.get_highest_resolution().download()
print('sucsess')
видео рандомное выбрал, ссылка рабочая