Pārlūkot izejas kodu

提取标题品类信息

luojunhui 9 stundas atpakaļ
vecāks
revīzija
cd3843189a

+ 23 - 26
applications/tasks/data_recycle_tasks/recycle_outside_account_articles.py

@@ -736,12 +736,13 @@ class UpdateOutsideRootSourceIdAndUpdateTimeTask(UpdateRootSourceIdAndUpdateTime
 
     async def get_outside_article_list_v2(self) -> list[dict]:
         query = """
-                select account_name, content_url, wx_sn 
+                select content_url, wx_sn 
                 from outside_account_articles where publish_timestamp in %s
+                    and account_name in %s
                 order by update_time desc;
             """
         article_list = await self.pool.async_fetch(
-            query=query, params=(tuple([0, -1, -3]),)
+            query=query, params=(tuple([0, -1, -3]), tuple(account_name_set))
         )
         return article_list
 
@@ -831,29 +832,25 @@ class UpdateOutsideRootSourceIdAndUpdateTimeTask(UpdateRootSourceIdAndUpdateTime
     async def deal(self):
         task_list = await self.get_outside_article_list_v2()
         for task in tqdm(task_list, desc="get article detail step1: "):
-            account_name = task["account_name"]
-            if account_name not in account_name_set:
-                continue
-            else:
+            try:
+                await self.check_each_article(task)
+            except Exception as e:
                 try:
-                    await self.check_each_article(task)
-                except Exception as e:
-                    try:
-                        await self.log_client.log(
-                            contents={
-                                "task": "get_official_article_detail_step1",
-                                "data": {
-                                    "detail": {
-                                        "url": task["ContentUrl"],
-                                        "wx_sn": task["wx_sn"],
-                                    },
-                                    "error_msg": traceback.format_exc(),
-                                    "error": str(e),
+                    await self.log_client.log(
+                        contents={
+                            "task": "get_official_article_detail_step1",
+                            "data": {
+                                "detail": {
+                                    "url": task["ContentUrl"],
+                                    "wx_sn": task["wx_sn"],
                                 },
-                                "function": "check_each_article",
-                                "status": "fail",
-                            }
-                        )
-                    except Exception as e:
-                        print(e)
-                        print(traceback.format_exc())
+                                "error_msg": traceback.format_exc(),
+                                "error": str(e),
+                            },
+                            "function": "check_each_article",
+                            "status": "fail",
+                        }
+                    )
+                except Exception as e:
+                    print(e)
+                    print(traceback.format_exc())