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

查看:25
本文介绍了从 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天全站免登陆