|
@@ -6,6 +6,7 @@ import random
|
|
|
import shutil
|
|
|
import sys
|
|
|
import time
|
|
|
+import string
|
|
|
from hashlib import md5
|
|
|
|
|
|
import requests
|
|
@@ -33,13 +34,12 @@ class KuaiShouRecommend:
|
|
|
try:
|
|
|
rule_sheet = Feishu.get_values_batch(log_type, crawler, "NQ6CZN")
|
|
|
rule_dict = {
|
|
|
- "play_cnt": int(rule_sheet[0][2]),
|
|
|
- # "comment_cnt": int(rule_sheet[1][2]),
|
|
|
- "video_width": int(rule_sheet[1][2]),
|
|
|
- "video_height": int(rule_sheet[2][2]),
|
|
|
- "duration": int(rule_sheet[3][2]),
|
|
|
- "publish_time": int(rule_sheet[4][2]),
|
|
|
- "like_cnt": int(rule_sheet[5][2])
|
|
|
+ "play_cnt": f"{rule_sheet[0][1]}{rule_sheet[0][2]}",
|
|
|
+ "video_width": f"{rule_sheet[1][1]}{rule_sheet[1][2]}",
|
|
|
+ "video_height": f"{rule_sheet[2][1]}{rule_sheet[2][2]}",
|
|
|
+ "like_cnt": f"{rule_sheet[5][1]}{rule_sheet[5][2]}",
|
|
|
+ "duration": f"{rule_sheet[3][1]}{rule_sheet[3][2]}",
|
|
|
+ "publish_time": f"{rule_sheet[4][1]}{rule_sheet[4][2]}",
|
|
|
}
|
|
|
return rule_dict
|
|
|
except Exception as e:
|
|
@@ -203,10 +203,13 @@ class KuaiShouRecommend:
|
|
|
},
|
|
|
"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\nfragment photoResult on PhotoResult {\n result\n llsid\n expTag\n serverExpTag\n pcursor\n feeds {\n ...feedContent\n __typename\n }\n webPageArea\n __typename\n}\n\nquery visionNewRecoFeed($semKeyword: String, $semCrowd: String, $utmSource: String, $utmMedium: String, $utmCampaign: String, $dailyFirstPage: Boolean) {\n visionNewRecoFeed(semKeyword: $semKeyword, semCrowd: $semCrowd, utmSource: $utmSource, utmMedium: $utmMedium, utmCampaign: $utmCampaign, dailyFirstPage: $dailyFirstPage) {\n ...photoResult\n __typename\n }\n}\n"
|
|
|
})
|
|
|
+ s = string.ascii_lowercase
|
|
|
+ r = random.choice(s)
|
|
|
+
|
|
|
headers = {
|
|
|
'Accept-Language': 'zh-CN,zh;q=0.9',
|
|
|
'Connection': 'keep-alive',
|
|
|
- 'Cookie': 'kpf=PC_WEB; clientid=3; did=web_aba004b1780f4d7174d0a2ff42da1fe7; kpn=KUAISHOU_VISION;',
|
|
|
+ 'Cookie': 'kpf=PC_WEB; clientid=3; did=web_aba004b1780f4d7174d0a2ff42da1f{r}7; kpn=KUAISHOU_VISION;'.format(r=r),
|
|
|
'Origin': 'https://www.kuaishou.com',
|
|
|
'Referer': 'https://www.kuaishou.com/new-reco',
|
|
|
'Sec-Fetch-Dest': 'empty',
|