Pytube 不下载视频
我安装了 pytube (pytube==12.0.0)
。当我运行代码时,它什么也不做,然后完成执行。它不会给出任何错误,但也不会下载视频。这可能与我的计算机上安装了一个过滤器有关,我之前在使用 heroku cli 时遇到过问题,因为它使用代理。但我还没有找到任何关于如何解决这个问题的信息。
我的代码是:
import pytube
url = 'https://www.youtube.com/watch?v=4SFhwxzfXNc'
youtube = pytube.YouTube(url)
video = youtube.streams.get_highest_resolution()
video.download('/Downloads')
I have pytube (pytube==12.0.0)
installed. When I run my code it just does nothing, and then finishes executing. It doesn't give any errors, but it also doesn't download the video. This might have something to do with the fact that I have a filter installed on my computer, I've had issues with that before when using the heroku cli, because it was using a proxy. I haven't been able to find anything on how to fix that though.
My code is:
import pytube
url = 'https://www.youtube.com/watch?v=4SFhwxzfXNc'
youtube = pytube.YouTube(url)
video = youtube.streams.get_highest_resolution()
video.download('/Downloads')
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
愚蠢的错误 -
video.download('/Downloads')
不是正确的文件路径。这是有效的代码:Stupid mistake -
video.download('/Downloads')
wasn't the right file path. This is the code that works:你尝试过吗?
来源:https://github.com/pytube/pytube/issues/1128
端口应该取决于你的代理
Did you tried?
Source: https://github.com/pytube/pytube/issues/1128
Port should depend on your proxy