I’ve been getting this error on several programs for now. I’ve tried upgrading pytube, reinstalling it, tried some fixes, changed URLs and code, but nothing seems to work.
JavaScript
x
19
19
1
from pytube import YouTube
2
3
#ask for the link from user
4
link = input("Enter the link of YouTube video you want to download: ")
5
yt = YouTube(link)
6
7
#Showing details
8
print("Title: ",yt.title)
9
print("Number of views: ",yt.views)
10
print("Length of video: ",yt.length)
11
print("Rating of video: ",yt.rating)
12
#Getting the highest resolution possible
13
ys = yt.streams.get_highest_resolution()
14
15
#Starting download
16
print("Downloading...")
17
ys.download()
18
print("Download completed!!")
19
and this is the error code:
JavaScript
1
34
34
1
File "C:UsersMadjidPycharmProjectspythonProjectapp2.py", line 6, in <module>
2
yt = YouTube(link)
3
File "C:UsersMadjidPycharmProjectspythonProjectvenvlibsite-packagespytube__main__.py", line 91, in __init__
4
self.prefetch()
5
File "C:UsersMadjidPycharmProjectspythonProjectvenvlibsite-packagespytube__main__.py", line 181, in prefetch
6
self.vid_info_raw = request.get(self.vid_info_url)
7
File "C:UsersMadjidPycharmProjectspythonProjectvenvlibsite-packagespytuberequest.py", line 36, in get
8
return _execute_request(url).read().decode("utf-8")
9
File "C:UsersMadjidPycharmProjectspythonProjectvenvlibsite-packagespytuberequest.py", line 24, in _execute_request
10
return urlopen(request) # nosec
11
File "E:Pythonliburllibrequest.py", line 214, in urlopen
12
return opener.open(url, data, timeout)
13
File "E:Pythonliburllibrequest.py", line 523, in open
14
response = meth(req, response)
15
File "E:Pythonliburllibrequest.py", line 632, in http_response
16
response = self.parent.error(
17
File "E:Pythonliburllibrequest.py", line 555, in error
18
result = self._call_chain(*args)
19
File "E:Pythonliburllibrequest.py", line 494, in _call_chain
20
result = func(*args)
21
File "E:Pythonliburllibrequest.py", line 747, in http_error_302
22
return self.parent.open(new, timeout=req.timeout)
23
File "E:Pythonliburllibrequest.py", line 523, in open
24
response = meth(req, response)
25
File "E:Pythonliburllibrequest.py", line 632, in http_response
26
response = self.parent.error(
27
File "E:Pythonliburllibrequest.py", line 561, in error
28
return self._call_chain(*args)
29
File "E:Pythonliburllibrequest.py", line 494, in _call_chain
30
result = func(*args)
31
File "E:Pythonliburllibrequest.py", line 641, in http_error_default
32
raise HTTPError(req.full_url, code, msg, hdrs, fp)
33
urllib.error.HTTPError: HTTP Error 410: Gone
34
Advertisement
Answer
Try to upgrade, there is a fix in version 11.0.0:
JavaScript
1
2
1
python -m pip install --upgrade pytube
2