从Python中的URL下载视频 [英] Download video from URL in Python

查看:768
本文介绍了从Python中的URL下载视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用以下代码在Python中下载视频。

I am trying to download a video using the below code in Python.

import urllib
dwn_link = 'https://class.coursera.org/textanalytics-001/lecture/download.mp4?lecture_id=73'

file_name = 'trial_video.mp4' 
urllib.retrieve(dwn_link, file_name)

但是此代码仅下载382 kb,并且视频打开并显示错误。

But this code downloads only 382 kb and video open with an error.

有帮助吗?

编辑:我可以使用其下载链接来下载此页面中的所有.pdf文件,但似乎有些视频文件出现问题。视频确实已从本地系统下载,但出现错误

I could download all .pdf files in this page using their download links, but there seems to be some issue with video files. Video does get downloaded int my local system, but with error

推荐答案

在python 3中,

In python 3,

import urllib.request
urllib.request.urlretrieve(url_link, 'video_name.mp4') 

它对我有用,您可以在以下链接

It works for me and you can see the script at the following link

这篇关于从Python中的URL下载视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆