luojunhui 6 mēneši atpakaļ
vecāks
revīzija
b0510cb044
1 mainītis faili ar 13 papildinājumiem un 3 dzēšanām
  1. 13 3
      coldStartTasks/crawler/weixin_video_crawler.py

+ 13 - 3
coldStartTasks/crawler/weixin_video_crawler.py

@@ -215,9 +215,19 @@ class WeixinVideoCrawler(object):
         """
         """
         account_list = self.get_crawler_accounts()
         account_list = self.get_crawler_accounts()
         for account_obj in tqdm(account_list, desc="crawler_video_for_each_account"):
         for account_obj in tqdm(account_list, desc="crawler_video_for_each_account"):
-            self.crawler_article_video_list(account_obj)
-            self.update_account_latest_crawler_timestamp(gh_id=account_obj["gh_id"])
-            time.sleep(const.SLEEP_SECONDS)
+            try:
+                self.crawler_article_video_list(account_obj)
+                self.update_account_latest_crawler_timestamp(gh_id=account_obj["gh_id"])
+                time.sleep(const.SLEEP_SECONDS)
+            except Exception as e:
+                error_stack = traceback.format_exc()
+                log(
+                    task='weixin_video_crawler',
+                    function="crawler_task",
+                    status="fail",
+                    message="抓取任务失败--单账号",
+                    data={"error": str(e), "error_stack": error_stack, "account_name": account_obj["account_name"]}
+                )
 
 
     def mention(self, start_timestamp):
     def mention(self, start_timestamp):
         """
         """