|
@@ -123,27 +123,27 @@ class KuaiShouFollow:
|
|
|
try:
|
|
|
url = "https://www.kuaishou.com/graphql"
|
|
|
payload = json.dumps({
|
|
|
- "operationName": "visionProfilePhotoList",
|
|
|
+ "operationName": "visionProfile",
|
|
|
"variables": {
|
|
|
- "userId": out_uid,
|
|
|
- "pcursor": "",
|
|
|
- "page": "profile"
|
|
|
+ "userId": out_uid
|
|
|
},
|
|
|
- "query": "fragment photoContent on PhotoEntity {\n id\n duration\n caption\n originCaption\n likeCount\n viewCount\n realLikeCount\n coverUrl\n photoUrl\n photoH265Url\n manifest\n manifestH265\n videoResource\n coverUrls {\n url\n __typename\n }\n timestamp\n expTag\n animatedCoverUrl\n distance\n videoRatio\n liked\n stereoType\n profileUserTopPhoto\n musicBlocked\n __typename\n}\n\nfragment feedContent on Feed {\n type\n author {\n id\n name\n headerUrl\n following\n headerUrls {\n url\n __typename\n }\n __typename\n }\n photo {\n ...photoContent\n __typename\n }\n canAddComment\n llsid\n status\n currentPcursor\n tags {\n type\n name\n __typename\n }\n __typename\n}\n\nquery visionProfilePhotoList($pcursor: String, $userId: String, $page: String, $webPageArea: String) {\n visionProfilePhotoList(pcursor: $pcursor, userId: $userId, page: $page, webPageArea: $webPageArea) {\n result\n llsid\n webPageArea\n feeds {\n ...feedContent\n __typename\n }\n hostName\n pcursor\n __typename\n }\n}\n"
|
|
|
+ "query": "query visionProfile($userId: String) {\n visionProfile(userId: $userId) {\n result\n hostName\n userProfile {\n ownerCount {\n fan\n photo\n follow\n photo_public\n __typename\n }\n profile {\n gender\n user_name\n user_id\n headurl\n user_text\n user_profile_bg_url\n __typename\n }\n isFollowing\n __typename\n }\n __typename\n }\n}\n"
|
|
|
})
|
|
|
headers = {
|
|
|
- 'User-Agent': get_random_user_agent('pc'),
|
|
|
- 'Accept': '*/*',
|
|
|
- 'Accept-Language': 'zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2',
|
|
|
- 'Accept-Encoding': 'gzip, deflate, br',
|
|
|
- 'Referer': f'https://www.kuaishou.com/profile/{out_uid}',
|
|
|
- 'content-type': 'application/json',
|
|
|
- 'Origin': 'https://www.kuaishou.com',
|
|
|
+ 'Accept-Language': 'zh-CN,zh;q=0.9',
|
|
|
'Connection': 'keep-alive',
|
|
|
- 'Cookie': 'kpf=PC_WEB; clientid=3; did=web_3a3ea737874da28fd2e54f304a192eff; kpn=KUAISHOU_VISION',
|
|
|
+ 'Cookie': 'kpf=PC_WEB; clientid=3; did=web_3910d9d51a5f6ac9cce8cb25cc0780ff; userId=1321650328; kuaishou.server.web_st=ChZrdWFpc2hvdS5zZXJ2ZXIud2ViLnN0EqAB7bjkVapctEeh2Vh6_w9YmSXFnxBUvy3dAIZZmpyd9sAJciYB48W_Ch7rN3r1mhKtJCtBGFqMX-cTy1RoGLLmaKpwQTvxjew1nsH6JacRsJf6qB0N273lzzmGeXQPxb-MVwqtoyvxL8bLJ0DcldtHb1Q36U4efpRFse9WYLL9PtlsEprI6xORB6a009HLlRKiKMzma5s_nhdwr5xt1QwnphoStVKEb-xUGkLo9u0A7O3lj4AGIiDTIZw_4BbSmp0oOBtTtItbuywLAU3zSIErl1q6F5AW8SgFMAE; kuaishou.server.web_ph=0efe610176ceb53a303c1256cd0f6ff0325e; kpn=KUAISHOU_VISION',
|
|
|
+ 'Origin': 'https://www.kuaishou.com',
|
|
|
+ 'Referer': 'https://www.kuaishou.com/profile/{}'.format(out_uid),
|
|
|
'Sec-Fetch-Dest': 'empty',
|
|
|
'Sec-Fetch-Mode': 'cors',
|
|
|
- 'Sec-Fetch-Site': 'same-origin'
|
|
|
+ 'Sec-Fetch-Site': 'same-origin',
|
|
|
+ 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36',
|
|
|
+ 'accept': '*/*',
|
|
|
+ 'content-type': 'application/json',
|
|
|
+ 'sec-ch-ua': '"Google Chrome";v="111", "Not(A:Brand";v="8", "Chromium";v="111"',
|
|
|
+ 'sec-ch-ua-mobile': '?0',
|
|
|
+ 'sec-ch-ua-platform': '"macOS"'
|
|
|
}
|
|
|
urllib3.disable_warnings()
|
|
|
s = requests.session()
|
|
@@ -768,14 +768,14 @@ class KuaiShouFollow:
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
- KuaiShouFollow.get_videoList(log_type="follow",
|
|
|
- crawler="kuaishou",
|
|
|
- strategy="定向爬虫策略",
|
|
|
- our_uid="54719554",
|
|
|
- out_uid="3xv5xwkfm9y9n86",
|
|
|
- oss_endpoint="out",
|
|
|
- env="dev",
|
|
|
- machine="local")
|
|
|
-
|
|
|
- # print(Follow.get_out_user_info("follow", "kuaishou", "3xgh4ja9be3wcaw"))
|
|
|
+ # KuaiShouFollow.get_videoList(log_type="follow",
|
|
|
+ # crawler="kuaishou",
|
|
|
+ # strategy="定向爬虫策略",
|
|
|
+ # our_uid="54719554",
|
|
|
+ # out_uid="3xnk3wbm3vfiha6",
|
|
|
+ # oss_endpoint="out",
|
|
|
+ # env="dev",
|
|
|
+ # machine="local")
|
|
|
+
|
|
|
+ print(KuaiShouFollow.get_out_user_info("follow", "kuaishou", "3xnk3wbm3vfiha6"))
|
|
|
# print(Follow.get_out_user_info("follow", "kuaishou", "3x5wgjhfc7tx8ue"))
|