Python 爬虫 Vimeo视频下载链接

2023-05-20,,

python vimeo_d.py https://vimeo.com/228013581

在https://vimeo.com/上看到稀罕的视频 按照上面加上视频的观看地址运行即可获得视频下载链接 支持三种方式爬取下载

(为了凑够150字+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++)

 #coding:utf-8
#sample url = 'https://vimeo.com/228013581' import requests
import json
import sys
import re
reload(sys)
sys.setdefaultencoding('utf-8') headers ={
'Accept-Encoding':'gzip, deflate, br',
'Accept-Language':'zh-CN,zh;q=0.8,en;q=0.6',
'Connection':'keep-alive',
'User-Agent':'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36'
} def process_1(cmd,url,headers):
_url = '%s?action=load_download_config' % url headers['Host']='vimeo.com'
headers['Referer']='%s' % url
headers['X-Requested-With']='XMLHttpRequest' r = requests.get(_url,headers=headers)
if str(r.status_code) =='':
f = r.json()['files']
for i in range(0,len(f)):
ml = f[i]
print "第%s条Download信息" % (i+1)
print '标题: %s' % ml['download_name']
print '链接: %s' % ml['download_url']
print ml['download_name'].split('_')[0] def process_2(cmd,url,headers):
_url = 'http://savevideo.me/get/' headers['Content-Type']='application/x-www-form-urlencoded; charset=UTF-8'
headers['Host']='savevideo.me'
headers['Origin']='http://savevideo.me'
headers['Referer']='http://savevideo.me/' r = requests.post(_url,headers=headers,data={'url':url})
if str(r.status_code) == '':
title = re.findall(r"<a.*?href=\"(.*?)\">D.*?<\/a>",r.text,re.S)
print title def process_3(cmd,url,headers):
_url = url r = requests.get(_url)
if str(r.status_code)=='':
title = re.findall(r"<script>.*?\"config_url.*?\"(http.*?)\".*?",r.text,re.S)
_url = title[0].replace('\\/\\/player','//player').replace('\\/video\\/','/video/').replace('\\/config','/config')
_r = requests.get(_url)
if str(_r.status_code) == '':
f = _r.json()['request']['files']['progressive']
q = _r.json()['video']['title']
print '标题:%s' % q
for i in range(0,len(f)):
width = f[i]['width']
height= f[i]['height']
url = f[i]['url']
quality = f[i]['quality']
print "第%s条Download信息" % (i+1)
print "质量%s*%s(mp4)" % (width,height)
print "链接%s" % (url) if __name__ == '__main__':
import sys
ml = eval("'parse',sys.argv[1],headers")
cmd, url, headers = ml
process_1(cmd,url,headers)
process_2(cmd,url,headers)
process_3(cmd,url,headers)

Python 爬虫 Vimeo视频下载链接的相关教程结束。

《Python 爬虫 Vimeo视频下载链接.doc》

下载本文的Word格式文档,以方便收藏与打印。