Explorar o código

小年糕话题母亲节

zhangyong hai 11 meses
pai
achega
9ede197e56
Modificáronse 1 ficheiros con 12 adicións e 18 borrados
  1. 12 18
      spider/crawler_online/xiaoniangaohuati.py

+ 12 - 18
spider/crawler_online/xiaoniangaohuati.py

@@ -66,26 +66,25 @@ class XNGHTecommend(object):
         # id = 1245  # 妇女节
         # id = 1248  # 二月二
         # id = 1253 # 清明节
-        i = 0
+        id = 1261  # 母亲节
+        score = -1
         while True:
             time.sleep(random.randint(1, 10))
-            url = "https://kapi.xiaoniangao.cn/activity/recommend_album_list"
+            url = "https://kapi.xiaoniangao.cn/sub/get_sub_cont_list"
             payload = json.dumps({
-                "offset": i,
-                "limit": 6,
-                "act_id": 70049,
+                "id": id,
+                "score": score,
                 "qs": "imageMogr2/gravity/center/rotate/$/thumbnail/!750x500r/crop/750x500/interlace/1/format/jpg",
                 "token": "b1c143a85f63bf4d99f74afc6322b5c4",
                 "uid": "78212db8-abbf-46db-8ff3-abf00967f461",
                 "proj": "ma",
                 "wx_ver": "3.8.6",
-                "code_ver": "4.62.0",
+                "code_ver": "4.64.0",
                 "log_common_params": {
                     "e": [
                         {
                             "data": {
-                                "page": "activityPage_70049",
-                                "topic": "hot_work"
+                                "page": "subjectPage"
                             }
                         }
                     ],
@@ -96,16 +95,16 @@ class XNGHTecommend(object):
                         "weixinver": "3.8.6",
                         "srcver": "3.3.5",
                         "net": "wifi",
-                        "scene": "1074"
+                        "scene": "1089"
                     },
                     "pj": "1",
                     "pf": "2",
-                    "session_id": "5925f2df-2cde-42dd-a741-34bc1f0528f0"
+                    "session_id": "eadf7939-5db1-4fd0-b0a7-a785a91f721d"
                 }
             })
 
             response = requests.request("POST", url, headers=headers, data=payload, proxies=tunnel_proxies())
-            i += 1
+            score = response.json()['data']['score']
             for index, video_obj in enumerate(response.json()['data']['list'], 1):
                 try:
                     self.aliyun_log.logging(
@@ -116,7 +115,7 @@ class XNGHTecommend(object):
                     self.aliyun_log.logging(
                         code="3000",
                         message="抓取单条视频失败,第{}条报错原因是{}".format(
-                             index, e
+                            index, e
                         ),
                     )
             if self.limit_flag:
@@ -156,8 +155,7 @@ class XNGHTecommend(object):
                 formatted_time,
                 video_obj["title"],
                 video_obj["url"],
-                video_obj["v_url"],
-                play_cnt
+                video_obj["v_url"]
             ]]
             Feishu.insert_columns('xiaoniangao', 'xiaoniangao', "BZb4Tc", "ROWS", 1, 2)
             time.sleep(0.5)
@@ -180,13 +178,9 @@ class XNGHTecommend(object):
                 ):
                     self.limit_flag = True
 
-
-
-
     def run(self):
         self.get_recommend_list()
 
-
 if __name__ == '__main__':
     J = XNGHTecommend(
         platform="xiaonianggaohuati",