无法使用pytube下载视频

Can't download video using pytube

我正在尝试制作一个 python 程序,该程序在使用 Pytube 模块 link 时下载 youtube 视频,但是当我尝试 运行 它时,它给出了一个巨大的错误如下-

Traceback (most recent call last):
  File "c:\Users\Sumit\vs code python\projects\proj's\yt.py", line 9, in <module>
    yt = YouTube(link) 
  File "C:\Python39\lib\site-packages\pytube\__main__.py", line 91, in __init__
    self.prefetch()
  File "C:\Python39\lib\site-packages\pytube\__main__.py", line 181, in prefetch
    self.vid_info_raw = request.get(self.vid_info_url)
  File "C:\Python39\lib\site-packages\pytube\request.py", line 36, in get
    return _execute_request(url).read().decode("utf-8")
  File "C:\Python39\lib\site-packages\pytube\request.py", line 24, in _execute_request
    return urlopen(request)  # nosec
  File "C:\Python39\lib\urllib\request.py", line 214, in urlopen
    return opener.open(url, data, timeout)
  File "C:\Python39\lib\urllib\request.py", line 523, in open
    response = meth(req, response)
  File "C:\Python39\lib\urllib\request.py", line 632, in http_response
    response = self.parent.error(
  File "C:\Python39\lib\urllib\request.py", line 555, in error
    result = self._call_chain(*args)
  File "C:\Python39\lib\urllib\request.py", line 494, in _call_chain
    result = func(*args)
  File "C:\Python39\lib\urllib\request.py", line 747, in http_error_302
    return self.parent.open(new, timeout=req.timeout)
  File "C:\Python39\lib\urllib\request.py", line 523, in open
    response = meth(req, response)
  File "C:\Python39\lib\urllib\request.py", line 632, in http_response
    response = self.parent.error(
  File "C:\Python39\lib\urllib\request.py", line 561, in error
    return self._call_chain(*args)
  File "C:\Python39\lib\urllib\request.py", line 494, in _call_chain
    result = func(*args)
  File "C:\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

我不知道是什么问题,我不明白我该怎么做,请帮忙。 另外,我用的是python 3.9,代码如下-

from pytube import YouTube 

SAVE_PATH = r"C:\Users\Sumit\vs code python\projects"  
  

link="https://www.youtube.com/watch?v=JfVOs4VSpmA&t=3s"
  
 
yt = YouTube(link) 

mp4files = yt.filter('mp4') 
  
yt.set_filename('Video')  

Avideo = yt.get(mp4files[-1].extension,mp4files[-1].resolution) 
try: 
    # downloading the video 
    Avideo.download(SAVE_PATH) 
except: 
    print("Some Error!") 
    
print('Task Completed!') 

https://pytube.io/en/latest/api.html#pytube.Stream.download

from pytube import YouTube 
SAVE_PATH = r"C:\Users\Sumit\vs code python\projects"  
link="https://www.youtube.com/watch?v=JfVOs4VSpmA&t=3s"


yt = YouTube('http://youtube.com/watch?v=9bZkp7q19f0')
yt.streams
.filter(progressive=True, file_extension='mp4')
.order_by('resolution')
.desc()
.first()
.download(SAVE_PATH, 'videoFilename', 'mp4')