wangkun 2 rokov pred
rodič
commit
8aa013338e

+ 1 - 1
xigua/xigua_follow/xigua_follow.py

@@ -794,7 +794,7 @@ class Follow:
                     if gid == 0 or video_id == 0 or cover_url == 0:
                     if gid == 0 or video_id == 0 or cover_url == 0:
                         Common.logger(log_type, crawler).info('无效视频\n')
                         Common.logger(log_type, crawler).info('无效视频\n')
                     elif is_top is True and int(time.time()) - int(publish_time) > 3600 * 24 * rule_dict['publish_time']:
                     elif is_top is True and int(time.time()) - int(publish_time) > 3600 * 24 * rule_dict['publish_time']:
-                        Common.logger(log_type, crawler).info(f'置顶视频,且发布时间:{publish_time_str}超过{rule_dict["publish_time"]}天\n')
+                        Common.logger(log_type, crawler).info(f'置顶视频,且发布时间:{publish_time_str} 超过{rule_dict["publish_time"]}天\n')
                     elif int(time.time()) - int(publish_time) > 3600 * 24 * rule_dict['publish_time']:
                     elif int(time.time()) - int(publish_time) > 3600 * 24 * rule_dict['publish_time']:
                         Common.logger(log_type, crawler).info(f'发布时间:{publish_time_str}超过{rule_dict["publish_time"]}天\n')
                         Common.logger(log_type, crawler).info(f'发布时间:{publish_time_str}超过{rule_dict["publish_time"]}天\n')
                         cls.offset = 0
                         cls.offset = 0

+ 10 - 5
xigua/xigua_main/run_xigua_follow.py

@@ -9,15 +9,20 @@ import time
 sys.path.append(os.getcwd())
 sys.path.append(os.getcwd())
 from common.common import Common
 from common.common import Common
 from xigua.xigua_follow.xigua_follow import Follow
 from xigua.xigua_follow.xigua_follow import Follow
+from common.feishu import Feishu
 
 
 
 
 def main(log_type, crawler, strategy, oss_endpoint, env, machine):
 def main(log_type, crawler, strategy, oss_endpoint, env, machine):
     while True:
     while True:
-        Common.logger(log_type, crawler).info('开始抓取 西瓜视频 定向榜\n')
-        Follow.get_follow_videos(log_type, crawler, strategy, oss_endpoint, env, machine)
-        Common.del_logs(log_type, crawler)
-        Common.logger(log_type, crawler).info('抓取完一轮,休眠 1 分钟\n')
-        time.sleep(60)
+        try:
+            Common.logger(log_type, crawler).info('开始抓取 西瓜视频 定向榜\n')
+            Follow.get_follow_videos(log_type, crawler, strategy, oss_endpoint, env, machine)
+            Common.del_logs(log_type, crawler)
+            Common.logger(log_type, crawler).info('抓取完一轮,休眠 1 分钟\n')
+            time.sleep(60)
+        except Exception as e:
+            Common.logger(log_type, crawler).info(f"西瓜视频异常,触发报警:{e}\n")
+            Feishu.bot(log_type, crawler, e)
 
 
 
 
 if __name__ == "__main__":
 if __name__ == "__main__":