在 Pytube 中获取 Http 错误 404。这是什么原因?

sha*_*893 11 python youtube-api http-error pytube

错误信息/代码

此代码曾经在 4 天前工作,现在显示错误。我尝试使用 pytube3 但这没有帮助。

from pytube import YouTube** 
YouTube('https://www.youtube.com/watch?v=JbBsqmKclXE').streams**
Run Code Online (Sandbox Code Playgroud)

()
----> 1 YouTube('https://www.youtube.com/watch?v=JbBsqmKclXE').streams 中的HTTPError Traceback(最近一次调用最后一次)

14 帧
/usr/lib/python3.7/urllib/request.py in http_error_default(self, req, fp, code, msg, hdrs)

647 class HTTPDefaultErrorHandler(BaseHandler):
648     def http_error_default(self, req, fp, code, msg, hdrs):
Run Code Online (Sandbox Code Playgroud)

--> 649 引发 HTTPError(req.full_url, code, msg, hdrs, fp) 650 651 类 HTTPRedirectHandler(BaseHandler):

HTTPError:HTTP 错误 404:未找到

sha*_*893 8

Ssuwani已修复此问题。您可以Pytube从安装

pip install git+https://github.com/ssuwani/pytube 
Run Code Online (Sandbox Code Playgroud)

  • 我在 Windows 10 上使用 pytube 10.9.3 和 python 3.9.5,并且发生此错误。即使在安装 pytibe 10.8.5 之后,错误仍然存​​在。 (5认同)
  • PyTube 官方版本也更新了修复程序。 (4认同)
  • Pytube 10.8.1 python 3.9.6 仍然出现同样的错误 (2认同)