Browse Source

1、小年糕和祝福圈子增加曝光
2、中青看点请求重试

zhangliang 1 tháng trước cách đây
mục cha
commit
952fc31bae

+ 14 - 12
spider/crawler_author/zhongqingkandian_author.py

@@ -185,26 +185,23 @@ class ZhongQingKanDianAuthor:
         while self.limit_flag:
             try:
                 self.download_cnt = self.db_ops.get_today_videos()
-                if self.download_cnt >= self.rule_dict.get("videos_cnt", {}).get("min", 100):
-                    self.aliyun_log.logging(
-                        code="2010",
-                        message=f"今日已经达到最大量",
-                        data=self.download_cnt
-                    )
-                    self.LocalLog.info(f"当日视频已达到最大爬取量{self.download_cnt}")
-                    return
                 self.LocalLog.info(f"开始用户视频列表的请求和处理流程,今日已爬 {self.download_cnt} 个视频")
                 if not self.zqkd_user_list:
                     self.LocalLog.info("没有用户数据")
                     time.sleep(10)
                     continue
                 for user_info in self.zqkd_user_list:
-                    # if not self.limit_flag:
-                    #     return
+                    if not self.limit_flag:
+                        self.aliyun_log.logging(
+                            code="2010",
+                            message=f"今日已经达到最大量",
+                            data=self.download_cnt
+                        )
+                        self.LocalLog.info("视频数量已达到预期")
+                        return
                     current_id, user_id = user_info
                     author_resp = self.req_user_list(user_id)
-                    if current_id > self.last_scanned_id:
-                        self.redis_ops.set_last_scanned_id(current_id)
+                    self.redis_ops.set_last_scanned_id(current_id)
                     if not author_resp:
                         continue
                     author_data = author_resp.get("data", {})
@@ -335,6 +332,11 @@ class ZhongQingKanDianAuthor:
             # 保存视频ID
             self.redis_ops.save_video_id(video_obj['channel_content_id'])
             if self.download_cnt >= self.rule_dict.get("videos_cnt", {}).get("min", 300) and self.zqkd_user_list:
+                self.aliyun_log.logging(
+                    code="2010",
+                    message=f"今日已经达到最大量",
+                    data=self.download_cnt
+                )
                 self.LocalLog.info("视频数量已达到预期")
                 # 判断视频数量达到预期且用户列表没有轮训完
                 # self.redis_ops.set_last_scanned_id(self.last_scanned_id)

+ 1 - 8
spider/crawler_online/zhongqingkandian_related_recommend.py

@@ -180,14 +180,7 @@ class ZhongQingKanDianRelatedRecommend:
         while self.limit_flag:
             try:
                 self.download_cnt = self.db_ops.get_today_videos()
-                if self.download_cnt >= self.rule_dict.get("videos_cnt", {}).get("min", 100):
-                    self.aliyun_log.logging(
-                        code="2010",
-                        message=f"今日已经达到最大量",
-                        data=self.download_cnt
-                    )
-                    self.LocalLog.info(f"当日视频已达到最大爬取量{self.download_cnt}")
-                    return
+
                 self.LocalLog.info(f"开始推荐视频列表的请求和处理流程,今日已爬 {self.download_cnt} 个视频")
 
                 content_id = self.redis_ops.get_recommend_video()