не работает Pytube.
Ошибка:
Traceback (most recent call last):
File "C:\Users\User\PycharmProjects\eeww\main.py", line 18, in
video = YouTube(URL)
File "C:\Users\User\PycharmProjects\eeww\venv\lib\site-packages\pytube\__main__.py", line 91, in __init__
self.prefetch()
File "C:\Users\User\PycharmProjects\eeww\venv\lib\site-packages\pytube\__main__.py", line 181, in prefetch
self.vid_info_raw = request.get(self.vid_info_url)
File "C:\Users\User\PycharmProjects\eeww\venv\lib\site-packages\pytube\request.py", line 36, in get
return _execute_request(url).read().decode("utf-8")
File "C:\Users\User\PycharmProjects\eeww\venv\lib\site-packages\pytube\request.py", line 24, in _execute_request
return urlopen(request) # nosec
File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\urllib\request.py", line 214, in urlopen
return opener.open(url, data, timeout)
File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\urllib\request.py", line 523, in open
response = meth(req, response)
File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\urllib\request.py", line 632, in http_response
response = self.parent.error(
File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\urllib\request.py", line 555, in error
result = self._call_chain(*args)
File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\urllib\request.py", line 494, in _call_chain
result = func(*args)
File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\urllib\request.py", line 747, in http_error_302
return self.parent.open(new, timeout=req.timeout)
File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\urllib\request.py", line 523, in open
response = meth(req, response)
File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\urllib\request.py", line 632, in http_response
response = self.parent.error(
File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\urllib\request.py", line 561, in error
return self._call_chain(*args)
File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\urllib\request.py", line 494, in _call_chain
result = func(*args)
File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\urllib\request.py", line 641, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 410: Gone
Код:
from pytube import YouTube
URL = str(input("Video URL: "))
quality = input("Video Quality \n1. 360p\n2. 480p\n3. 720p\n4. 1080p\nChoose Video Quality: ")
itag = 0
if quality == 1:
itag = 18
elif quality == 2:
itag = 135
elif quality == 3:
itag = 22
elif quality == 4:
itag = 37
video_path = str(input("Video Path: "))
video = YouTube(URL)
video_streams = video.streams.filter(file_extension='mp4').get_by_itag(itag)
video_streams.download(filename = video_streams.title, output_path = video_path)