|
@@ -134,7 +134,7 @@ class KuaiShouFollow:
|
|
|
'Accept': '*/*',
|
|
|
'Content-Type': 'application/json',
|
|
|
'Origin': 'https://www.kuaishou.com',
|
|
|
- 'Cookie': 'did=web_b16e6ef862b22f8276ebec7ac73b5a72; clientid=3; kpf=PC_WEB; kpn=KUAISHOU_VISION',
|
|
|
+ 'Cookie': 'did=web_248d27bda12bd3eee779d6b200ad8f8f;; clientid=3; kpf=PC_WEB; kpn=KUAISHOU_VISION',
|
|
|
'Content-Length': '552',
|
|
|
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
|
|
|
'Host': 'www.kuaishou.com',
|
|
@@ -361,7 +361,7 @@ class KuaiShouFollow:
|
|
|
rule_dict_2 = cls.get_rule(log_type, crawler, 2)
|
|
|
if rule_dict_1 is None or rule_dict_2 is None:
|
|
|
Common.logger(log_type, crawler).warning(f"rule_dict is None, 10秒后重试")
|
|
|
- time.sleep(10)
|
|
|
+ return
|
|
|
try:
|
|
|
if download_cnt_1 >= int(
|
|
|
rule_dict_1['download_cnt'].replace("=", "")[-1].replace("<", "")[-1].replace(">", "")[
|
|
@@ -377,7 +377,7 @@ class KuaiShouFollow:
|
|
|
"operationName": "visionProfilePhotoList",
|
|
|
"variables": {
|
|
|
"userId": out_uid,
|
|
|
- "pcursor": "",
|
|
|
+ "pcursor": pcursor,
|
|
|
"page": "profile"
|
|
|
},
|
|
|
"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"
|
|
@@ -386,11 +386,11 @@ class KuaiShouFollow:
|
|
|
'Accept': '*/*',
|
|
|
'Content-Type': 'application/json',
|
|
|
'Origin': 'https://www.kuaishou.com',
|
|
|
- 'Cookie': 'did=web_b16e6ef862b22f8276ebec7ac73b5a72; clientid=3; kpf=PC_WEB; kpn=KUAISHOU_VISION',
|
|
|
+ 'Cookie': 'did=web_248d27bda12bd3eee779d6b200ad8f8f; clientid=3; kpf=PC_WEB; kpn=KUAISHOU_VISION',
|
|
|
'Content-Length': '1244',
|
|
|
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
|
|
|
'Host': 'www.kuaishou.com',
|
|
|
- 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.6.1 Safari/605.1.15',
|
|
|
+ 'User-Agent': get_random_user_agent('pc'),
|
|
|
'Referer': 'https://www.kuaishou.com/profile/{}'.format(out_uid),
|
|
|
'Accept-Encoding': 'gzip, deflate, br',
|
|
|
'Connection': 'keep-alive'
|
|
@@ -602,11 +602,11 @@ class KuaiShouFollow:
|
|
|
Common.logger(log_type, crawler).info("不满足下载规则\n")
|
|
|
# Common.logger(log_type, crawler).info(f"feeds: {feeds}\n")
|
|
|
|
|
|
- # if pcursor == "no_more":
|
|
|
- # Common.logger(log_type, crawler).info(f"作者,{out_uid},已经到底了,没有更多内容了\n")
|
|
|
- # return
|
|
|
- # cls.get_videoList(log_type, crawler, strategy, our_uid, out_uid, oss_endpoint, env, machine,
|
|
|
- # pcursor=pcursor)
|
|
|
+ if pcursor == "no_more":
|
|
|
+ Common.logger(log_type, crawler).info(f"作者,{out_uid},已经到底了,没有更多内容了\n")
|
|
|
+ return
|
|
|
+ cls.get_videoList(log_type, crawler, strategy, our_uid, out_uid, oss_endpoint, env, machine,
|
|
|
+ pcursor=pcursor)
|
|
|
except Exception as e:
|
|
|
Common.logger(log_type, crawler).error(f"get_videoList:{e}\n")
|
|
|
|