Python视频下载到客户端直接浏览器
我遇到了这个Pytube库从YouTube下载视频,现在将视频下载到运行脚本的本地系统中。
我认为:该应用应该首先获取视频并将其存储在服务器中,然后让用户下载它。我不知道这是正确的方法。
很想学习其他方法。...
这是样板板pytube代码:
import pytube
url = 'https://www.youtube.com/watch?v=4SFhwxzfXNc'
youtube = pytube.YouTube(url)
video = youtube.streams.first()
video.download('../Video')
I came across this Pytube library to download videos from YouTube, Now the video gets downloaded to the local system that runs the script but what I want to do is let user click a HTML button on a web app to download that video directly to their system.
What I thought: The app should first get the video and store it in a server and then let users download it. I don't know if this is the right approach.
Would love to learn other approaches....
Here is the boilerplate pytube code:
import pytube
url = 'https://www.youtube.com/watch?v=4SFhwxzfXNc'
youtube = pytube.YouTube(url)
video = youtube.streams.first()
video.download('../Video')
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这将根据您的要求在 localhost 上工作,但这不适用于像 heroku 服务器这样的实时服务器。
This will work on localhost as your requirements but this won't work on live server like heroku server.
我正在从事一个类似的项目。这对我有用:
让我知道这是否是您想要的! :)
I'm working on a similar project. This worked for me:
Let me know if this is what you were looking for! :)