抖音爬膩了,安卓爬膩了?python爬取快手ios端首頁熱門視訊!
最近快手這種小視訊app,特別的火,中午吃過午飯,閒來無聊,想搞下快手的短視訊,看能不能搞到。
於是乎,
打開了fiddler,開始準備抓包,
學習Python中有不明白推薦加入交流群
號:864573496群裡有志同道合的小夥伴,互幫互助,群裡有不錯的視訊學習教程和PDF!每晚8:00群裡直播

設定代理,重啟,下一步,檢視本機ip

手機開啟網路設定
通過代理伺服器;
設定好,重新整理快手app

看到請求,去找自己要用的,
非了九牛二虎之力找到了。

看下需要的引數,建立新的py檔案,
吧引數完全複製過來。
1
2
3
4
5
6
7
8
9
10
client_key 21121
count 20
country_code cn
id 16
language zh-Hans-CN;q=1
pv false
refreshTimes 1
sig 2121
source 1
type 7
然後去寫程式碼

import requests,json
url='http://124.243.249.4/rest/n/feed/hot?appver=5.7.5.508&did=EB3C5966-C50E-432D-801E-D7EB42964654&c=a&ver=5.7&sys=ios9.3.5&mod=iPhone7%2C2&net=%E4%B8%AD%E5%9B%BD%E7%A7%BB%E5%8A%A8_5'headers={
'Content-Type':'application/x-www-form-urlencoded',
'Host':'124.243.205.129',
'Accept-Language':'zh-Hans-CN;q=1'}
data={
'client_key':'12',
'coldStart':'true',
'count':'20',
'country_code':'cn',
'id':'5',
'language':'zh-Hans-CN;q=1',
'pv':'false',
'refreshTimes':'0',
'sig':'111',
'source':'1',
'type':'7'}
jso=requests.post(url,data=(data),headers=headers)
list=jso.json()['feeds']foriin list:
print('描述:%s'%i['caption'])
print('視訊連線:%s'%i['main_mv_urls'][0]['url'])
print('作者:%s'%i['user_name'])print('使用者id:%s'%i['user_id'])

列印下我們輸出的

開啟連線。下載後就可以播放了。

然後這裡還可以根據返回的資訊去找視訊的評論。
仔細去分析,就能爬取到。
熱門視訊,熱門圖片等都能爬取到。