I am facing this error while making a program to download YouTube Videos using GUI (Tkinter ttk) Please somebody help me :( I tried so many stackoverflow queries but nothing helped me and even i copied the initial code from Github but error persist in my system however the code was running properly at the reference person Maybe its connection error or something and one things that i have 2 chrome extensions: 1.Touch Vpn 2.Meta Mask
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python39\lib\tkinter\__init__.py", line 1892, in __call__
return self.func(*args)
File "f:\Sumant\Python\YouTube Downloader\yt.py", line 25, in download
yt = YouTube(url)
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python39\lib\site-packages\pytube\__main__.py", line 91, in __init__
self.prefetch()
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python39\lib\site-packages\pytube\__main__.py", line 181, in prefetch
self.vid_info_raw = request.get(self.vid_info_url)
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python39\lib\site-packages\pytube\request.py", line 36, in get
return _execute_request(url).read().decode("utf-8")
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python39\lib\site-packages\pytube\request.py", line 24, in _execute_request
return urlopen(request) # nosec
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python39\lib\urllib\request.py", line 214, in urlopen
return opener.open(url, data, timeout)
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python39\lib\urllib\request.py", line 523, in open
response = meth(req, response)
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python39\lib\urllib\request.py", line 632, in http_response
response = self.parent.error(
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python39\lib\urllib\request.py", line 555, in error
result = self._call_chain(*args)
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python39\lib\urllib\request.py", line 494, in _call_chain
result = func(*args)
File "C:\Users\lenovo\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\lenovo\AppData\Local\Programs\Python\Python39\lib\urllib\request.py", line 523, in open
response = meth(req, response)
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python39\lib\urllib\request.py", line 632, in http_response
response = self.parent.error(
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python39\lib\urllib\request.py", line 561, in error
return self._call_chain(*args)
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python39\lib\urllib\request.py", line 494, in _call_chain
result = func(*args)
File "C:\Users\lenovo\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
Code
def download():
url = ent_link.get()
res = var.get()
if len(url) < 1:
messagebox.showerror("Error", "URL cannot be Empty")
yt = YouTube(url)
try:
if var.get() == 0:
reso_select = yt.streams.get_highest_resolution()
elif var.get() == 1:
reso_select = yt.streams.get_lowest_resolution()
elif var.get() == 2:
reso_select = yt.streams.filter(only_audio=True).first()
else:
reso_select = yt.streams.get_highest_resolution()
try:
reso_select.download(path1)
messagebox.showinfo("Sucess", "Video Downloaded!")
except:
messagebox.showerror("Error", "Download Failed")
except:
messagebox.showerror("Error","Please try again")
Maybe there is error at line yt = YouTube(url)
Full Code GitHub Repository