Python 爬虫 Vimeo视频下载链接
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Python 爬虫 Vimeo视频下载链接相关的知识,希望对你有一定的参考价值。
python vimeo_d.py https://vimeo.com/228013581
在https://vimeo.com/上看到稀罕的视频 按照上面加上视频的观看地址运行即可获得视频下载链接
(为了凑够150字+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++)
1 #coding:utf-8 2 #sample url = ‘https://vimeo.com/228013581‘ 3 4 5 import requests 6 import json 7 import sys 8 reload(sys) 9 sys.setdefaultencoding(‘utf-8‘) 10 11 12 def process(cmd,url): 13 _url = ‘%s?action=load_download_config‘ % url 14 15 headers ={ 16 ‘Accept-Encoding‘:‘gzip, deflate, br‘, 17 ‘Accept-Language‘:‘zh-CN,zh;q=0.8,en;q=0.6‘, 18 ‘Connection‘:‘keep-alive‘, 19 ‘Host‘:‘vimeo.com‘, 20 ‘Referer‘:‘%s‘ % url, 21 ‘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‘, 22 ‘X-Requested-With‘:‘XMLHttpRequest‘ 23 } 24 25 r = requests.get(_url,headers=headers) 26 #print r.status_code 27 f = r.json()[‘files‘] 28 for i in range(0,len(f)): 29 ml = f[i] 30 print "第%s条Download信息" % (i+1) 31 print ‘标题: %s‘ % ml[‘download_name‘] 32 print ‘链接: %s‘ % ml[‘download_url‘] 33 34 if __name__ == ‘__main__‘: 35 import sys 36 process(‘parse‘,sys.argv[1])
以上是关于Python 爬虫 Vimeo视频下载链接的主要内容,如果未能解决你的问题,请参考以下文章
Python练习册 第 0013 题: 用 Python 写一个爬图片的程序,爬 这个链接里的日本妹子图片 :-),(http://tieba.baidu.com/p/2166231880)(代码片段