输入视频链接,python后台下载视频
# encoding: utf-8
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
import requests
import re
import time
time1=time.time()
link='http://v3.365yg.com/a0ee2d891f16098d3098f8f14361493b/593e7f87/video/m/114263c000029b7a100c8372202f1d08555e434b0ca008b838dbe310e8/'
dest_resp = requests.get(link)
#视频是二进制数据流,content就是为了获取二进制数据的方法
data = dest_resp.content
#保存数据的路径及文件名
path = u'C:/zhang.mp4'
f = open(path, 'wb')
f.write(data)
f.close()
time2 = time.time()
print u'ok,下载完成!'
print u'总共耗时:' + str(time2 - time1) + 's'