|
|
@@ -32,12 +32,11 @@ class AdPlatformAccountsMonitorTask(AdPlatformAccountsMonitorTaskConst):
|
|
|
print("锁抢占失败")
|
|
|
return acquire_lock
|
|
|
|
|
|
- article_detail = await get_article_detail(
|
|
|
- article_link, is_count=True, is_cache=False
|
|
|
- )
|
|
|
+ article_detail = await get_article_detail(article_link)
|
|
|
if not article_detail:
|
|
|
+ # 如果爬虫偶发失败,则回退为 init 状态
|
|
|
return await self.mapper.update_fetch_status(
|
|
|
- wx_sn, self.PROCESSING_STATUS, self.FAIL_STATUS
|
|
|
+ wx_sn, self.PROCESSING_STATUS, self.INIT_STATUS
|
|
|
)
|
|
|
|
|
|
# 更新文章信息
|
|
|
@@ -51,10 +50,10 @@ class AdPlatformAccountsMonitorTask(AdPlatformAccountsMonitorTaskConst):
|
|
|
params = (
|
|
|
article.get("body_text", None),
|
|
|
self.tool.json_dumps(images),
|
|
|
- article.get("view_count", None),
|
|
|
- article.get("like_count", None),
|
|
|
- article.get("share_count", None),
|
|
|
- article.get("looking_count", None),
|
|
|
+ # article.get("view_count", None),
|
|
|
+ # article.get("like_count", None),
|
|
|
+ # article.get("share_count", None),
|
|
|
+ # article.get("looking_count", None),
|
|
|
int(article.get("publish_timestamp", 0) / 1000),
|
|
|
self.SUCCESS_STATUS,
|
|
|
wx_sn,
|
|
|
@@ -241,8 +240,9 @@ class AdPlatformAccountsMonitorTask(AdPlatformAccountsMonitorTaskConst):
|
|
|
article_list = await self.mapper.get_head_article_list()
|
|
|
for article in tqdm(article_list, desc="处理文章详情"):
|
|
|
try:
|
|
|
- print(article)
|
|
|
await self.set_article_detail(article)
|
|
|
+ # 等待一会儿
|
|
|
+ await self.tool.sleep_between_each_request()
|
|
|
|
|
|
except Exception as e:
|
|
|
print(f"获取文章详情失败-{article['article_link']}-{e}")
|