pytube error while downloading video: urllib.error.HTTPError: HTTP Error 404: Not Found
pytube error while downloading video: urllib.error.HTTPError: HTTP Error 404: Not Found
我正在制作一个简单的 youtube 视频 downloader.It 下载视频没有任何错误,但是当我尝试下载这个“video”时它给出了 error.I 之前已经下载过这个视频很多次没有任何错误。
Traceback (most recent call last):
File "c:\Users\Roshaan\AppData\Local\Programs\Python\Python39\Python\jarvis\test1.py", line 15, in <module>
d = yt.streams.filter(res = "240p").first()
File "C:\Users\Roshaan\AppData\Local\Programs\Python\Python39\lib\site-packages\pytube\__main__.py", line 311, in streams
return StreamQuery(self.fmt_streams)
File "C:\Users\Roshaan\AppData\Local\Programs\Python\Python39\lib\site-packages\pytube\__main__.py", line 214, in fmt_streams
if "adaptive_fmts" in self.player_config_args:
File "C:\Users\Roshaan\AppData\Local\Programs\Python\Python39\lib\site-packages\pytube\__main__.py", line 188, in player_config_args
self._player_config_args = self.vid_info
File "C:\Users\Roshaan\AppData\Local\Programs\Python\Python39\lib\site-packages\pytube\__main__.py", line 281, in vid_info
return dict(parse_qsl(self.vid_info_raw))
File "C:\Users\Roshaan\AppData\Local\Programs\Python\Python39\lib\site-packages\pytube\__main__.py", line 109, in vid_info_raw
self._vid_info_raw = request.get(self.vid_info_url)
File "C:\Users\Roshaan\AppData\Local\Programs\Python\Python39\lib\site-packages\pytube\request.py", line 53, in get
response = _execute_request(url, headers=extra_headers, timeout=timeout)
File "C:\Users\Roshaan\AppData\Local\Programs\Python\Python39\lib\site-packages\pytube\request.py", line 37, in _execute_request
return urlopen(request, timeout=timeout) # nosec
File "C:\Users\Roshaan\AppData\Local\Programs\Python\Python39\lib\urllib\request.py", line 214, in urlopen
return opener.open(url, data, timeout)
File "C:\Users\Roshaan\AppData\Local\Programs\Python\Python39\lib\urllib\request.py", line 523, in open
response = meth(req, response)
File "C:\Users\Roshaan\AppData\Local\Programs\Python\Python39\lib\urllib\request.py", line 632, in http_response
response = self.parent.error(
File "C:\Users\Roshaan\AppData\Local\Programs\Python\Python39\lib\urllib\request.py", line 561, in error
return self._call_chain(*args)
File "C:\Users\Roshaan\AppData\Local\Programs\Python\Python39\lib\urllib\request.py", line 494, in _call_chain
result = func(*args)
File "C:\Users\Roshaan\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 404: Not Found
我不明白为什么这个 happens.I 看到其他人提出的相同问题并更新了 pytube,它接受了其他人的解决方案但对 me.This 不起作用 me.This 是我的代码
yt = YouTube("https://www.youtube.com/watch?v=wZ6W3ryNVNE&list=PLqzeul28y04UGw8RHAN37Gjh0ZLmg3-qe")
d = yt.streams.filter(res = "240p").first()
d.download()
此错误是 pytube
包中反复出现的问题。它似乎在每次更新后都已修复,但随后又回到了这个问题。如果您有 运行 pip install --upgrade pytube
但问题仍然存在,那么您将不得不等待下一次更新。
在等待期间,我建议您使用 pytube
的替代方法... youtube_dl
您可能需要检查一下,因为它更可靠。官方website, installation.
我正在制作一个简单的 youtube 视频 downloader.It 下载视频没有任何错误,但是当我尝试下载这个“video”时它给出了 error.I 之前已经下载过这个视频很多次没有任何错误。
Traceback (most recent call last):
File "c:\Users\Roshaan\AppData\Local\Programs\Python\Python39\Python\jarvis\test1.py", line 15, in <module>
d = yt.streams.filter(res = "240p").first()
File "C:\Users\Roshaan\AppData\Local\Programs\Python\Python39\lib\site-packages\pytube\__main__.py", line 311, in streams
return StreamQuery(self.fmt_streams)
File "C:\Users\Roshaan\AppData\Local\Programs\Python\Python39\lib\site-packages\pytube\__main__.py", line 214, in fmt_streams
if "adaptive_fmts" in self.player_config_args:
File "C:\Users\Roshaan\AppData\Local\Programs\Python\Python39\lib\site-packages\pytube\__main__.py", line 188, in player_config_args
self._player_config_args = self.vid_info
File "C:\Users\Roshaan\AppData\Local\Programs\Python\Python39\lib\site-packages\pytube\__main__.py", line 281, in vid_info
return dict(parse_qsl(self.vid_info_raw))
File "C:\Users\Roshaan\AppData\Local\Programs\Python\Python39\lib\site-packages\pytube\__main__.py", line 109, in vid_info_raw
self._vid_info_raw = request.get(self.vid_info_url)
File "C:\Users\Roshaan\AppData\Local\Programs\Python\Python39\lib\site-packages\pytube\request.py", line 53, in get
response = _execute_request(url, headers=extra_headers, timeout=timeout)
File "C:\Users\Roshaan\AppData\Local\Programs\Python\Python39\lib\site-packages\pytube\request.py", line 37, in _execute_request
return urlopen(request, timeout=timeout) # nosec
File "C:\Users\Roshaan\AppData\Local\Programs\Python\Python39\lib\urllib\request.py", line 214, in urlopen
return opener.open(url, data, timeout)
File "C:\Users\Roshaan\AppData\Local\Programs\Python\Python39\lib\urllib\request.py", line 523, in open
response = meth(req, response)
File "C:\Users\Roshaan\AppData\Local\Programs\Python\Python39\lib\urllib\request.py", line 632, in http_response
response = self.parent.error(
File "C:\Users\Roshaan\AppData\Local\Programs\Python\Python39\lib\urllib\request.py", line 561, in error
return self._call_chain(*args)
File "C:\Users\Roshaan\AppData\Local\Programs\Python\Python39\lib\urllib\request.py", line 494, in _call_chain
result = func(*args)
File "C:\Users\Roshaan\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 404: Not Found
我不明白为什么这个 happens.I 看到其他人提出的相同问题并更新了 pytube,它接受了其他人的解决方案但对 me.This 不起作用 me.This 是我的代码
yt = YouTube("https://www.youtube.com/watch?v=wZ6W3ryNVNE&list=PLqzeul28y04UGw8RHAN37Gjh0ZLmg3-qe")
d = yt.streams.filter(res = "240p").first()
d.download()
此错误是 pytube
包中反复出现的问题。它似乎在每次更新后都已修复,但随后又回到了这个问题。如果您有 运行 pip install --upgrade pytube
但问题仍然存在,那么您将不得不等待下一次更新。
在等待期间,我建议您使用 pytube
的替代方法... youtube_dl
您可能需要检查一下,因为它更可靠。官方website, installation.