Selaa lähdekoodia

优乐搞笑小视频——增加其他 tab

罗俊辉 1 vuosi sitten
vanhempi
commit
28bdb4fe32

+ 2 - 10
common/pipeline.py

@@ -12,7 +12,7 @@ class PiaoQuanPipeline:
         self.rule_dict = rule_dict
         self.env = env
 
-    # 视频的发布时间限制
+    # 视频的发布时间限制, 属于是规则过滤
     def publish_time_flag(self):
         # 判断发布时间
         publish_time_stamp = self.item["publish_time_stamp"]
@@ -45,7 +45,7 @@ class PiaoQuanPipeline:
         sensitive_words = []
         if any(word in cleaned_title for word in sensitive_words):
             AliyunLogger.logging(
-                code="2004",
+                code="2003",
                 platform=self.platform,
                 mode=self.mode,
                 env=self.env,
@@ -149,12 +149,4 @@ class PiaoQuanPipeline:
         if not self.download_rule_flag():
             # 记录相关日志
             return False
-        AliyunLogger.logging(
-            code="1002",
-            platform=self.platform,
-            mode=self.mode,
-            env=self.env,
-            data=self.item,
-            message="该视频符合抓取条件,准备发往 ETL",
-        )
         return True

+ 8 - 1
youlegaoxiaoxiaoshipin/youlegaoxiaoxiaoshipin_main/run_ylgxxsp_recommend.py

@@ -81,6 +81,13 @@ def main(my_platform, mode, topic_name, group_id, env):
                 for user in user_list:
                     our_uid_list.append(user["uid"])
                 our_uid = random.choice(our_uid_list)
+                AliyunLogger.logging(
+                    code="1003",
+                    platform=my_platform,
+                    mode=mode,
+                    env=env,
+                    message="成功获取信息,启动爬虫,开始一轮抓取",
+                )
                 YLGXXSP = YLGXXSPScheduling(
                     platform=my_platform,
                     mode=mode,
@@ -97,7 +104,7 @@ def main(my_platform, mode, topic_name, group_id, env):
                         time.sleep(60)
 
                 AliyunLogger.logging(
-                    code="1000",
+                    code="1004",
                     platform=my_platform,
                     mode=mode,
                     env=env,

+ 3 - 4
youlegaoxiaoxiaoshipin/youlegaoxiaoxiaoshipin_recommend/youlegaoxiaoxiaoshipin_scheduling.py

@@ -147,13 +147,14 @@ class YLGXXSPScheduling:
             "profile_mid": 0,
             "session": f"youlegaoxiaoxiaoshipin-{int(time.time())}",
         }
-        flag = PiaoQuanPipeline(
+        rule_pipeline = PiaoQuanPipeline(
             platform=self.platform,
             mode=self.mode,
             rule_dict=self.rule_dict,
             env=self.env,
             item=video_dict,
         )
+        flag = rule_pipeline.process_item()
         if flag:
             video_dict["out_user_id"] = video_obj["data"].get("ownerId", 0)
             video_dict["platform"] = self.platform
@@ -166,12 +167,10 @@ class YLGXXSPScheduling:
             video_dict["publish_time"] = video_dict["publish_time_str"]
             video_dict["video_url"] = video_obj["data"]["url"]
             video_dict["avatar_url"] = "http:" + video_obj["data"]["avatar"]
-            video_dict["cover_url"] = "http:" + video_obj["data"]["thumbUrl"]
-            # print(json.dumps(video_dict, ensure_ascii=False, indent=4))
             self.download_count += 1
             self.mq.send_msg(video_dict)
             AliyunLogger.logging(
-                code="1000",
+                code="1002",
                 platform=self.platform,
                 mode=self.mode,
                 env=self.env,