1. 程式人生 > >Python 爬蟲 Vimeo視頻下載鏈接

Python 爬蟲 Vimeo視頻下載鏈接

color ref conn requested action def blog .com argv

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視頻下載鏈接