Browse Source

福小顺上线(异步)

罗俊辉 1 year ago
parent
commit
4f49d9c8ef
1 changed files with 4 additions and 1 deletions
  1. 4 1
      spider/crawler_online/fuxiaoshun.py

+ 4 - 1
spider/crawler_online/fuxiaoshun.py

@@ -100,6 +100,7 @@ class FuXiaoShunRecommend(object):
         if pipeline.process_item():
         if pipeline.process_item():
             self.download_cnt += 1
             self.download_cnt += 1
             self.mq.send_msg(mq_obj)
             self.mq.send_msg(mq_obj)
+            # print(json.dumps(mq_obj, ensure_ascii=False, indent=4))
             self.aliyun_log.logging(
             self.aliyun_log.logging(
                 code="1002",
                 code="1002",
                 message="成功发送至 ETL",
                 message="成功发送至 ETL",
@@ -134,7 +135,7 @@ class FuXiaoShunRecommend(object):
             "mark": "",
             "mark": "",
             "page": page_index
             "page": page_index
         }
         }
-        async with session.get(url, headers=headers, params=params, proxy=tunnel_proxies()) as response:
+        async with session.get(url, headers=headers, params=params, proxy=tunnel_proxies()['https']) as response:
             cryp_data = await response.json()
             cryp_data = await response.json()
             data = json.loads(fxs_decrypt(cryp_data['data']))
             data = json.loads(fxs_decrypt(cryp_data['data']))
             for index, video_obj in enumerate(data['list'], 1):
             for index, video_obj in enumerate(data['list'], 1):
@@ -163,6 +164,8 @@ class FuXiaoShunRecommend(object):
                         code="2000",
                         code="2000",
                         message="本轮已经抓取到足够的数据,自动退出\t{}".format(self.download_cnt)
                         message="本轮已经抓取到足够的数据,自动退出\t{}".format(self.download_cnt)
                     )
                     )
+                    message = "本轮已经抓取到足够的数据,自动退出\t{}".format(self.download_cnt)
+                    print(message)
                     return
                     return
                 else:
                 else:
                     try:
                     try: