在Pytube中获取Http错误404。这是什么原因?
此代码曾经在 4 天前工作,现在显示错误。我尝试使用 pytube3 但这没有帮助。
from pytube import YouTube**
YouTube('https://www.youtube.com/watch?v=JbBsqmKclXE').streams**
()
----> 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):
--> 649 引发 HTTPError(req.full_url, code, msg, hdrs, fp) 650 651 类 HTTPRedirectHandler(BaseHandler):
HTTPError:HTTP 错误 404:未找到
回答
Ssuwani已修复此问题。您可以Pytube从安装
pip install git+https://github.com/ssuwani/pytube
- 我在 Windows 10 上使用 pytube 10.9.3 和 python 3.9.5,并且发生此错误。即使在安装 pytibe 10.8.5 之后,错误仍然存在。
- PyTube official release is also updated with the fix.
- Pytube 10.8.1 python 3.9.6 仍然出现同样的错误