|
@@ -5,6 +5,7 @@ from datetime import datetime
|
|
|
from typing import Optional, List, Dict
|
|
|
from pandas import DataFrame
|
|
|
from scipy import stats
|
|
|
+from tqdm.asyncio import tqdm
|
|
|
|
|
|
|
|
|
class CrawlerAccountManagerConst:
|
|
@@ -94,8 +95,8 @@ class WeixinAccountManager(CrawlerAccountManager):
|
|
|
history_info["ci_lower"],
|
|
|
recently_info["publish_frequency"],
|
|
|
recently_info["ci_lower"],
|
|
|
- account_id,
|
|
|
datetime.today().strftime("%Y-%m-%d"),
|
|
|
+ account_id,
|
|
|
),
|
|
|
)
|
|
|
|
|
@@ -128,13 +129,13 @@ class WeixinAccountManager(CrawlerAccountManager):
|
|
|
"ci_upper": self.safe_float(ci_upper),
|
|
|
}
|
|
|
|
|
|
- async def analysis_single_account(self, account_id: str) -> None:
|
|
|
+ async def analysis_single_account(self, account_id: str) -> int:
|
|
|
dataframe = await self.get_account_crawler_articles_info(account_id)
|
|
|
history_articles_analysis = self.analysis_dataframe(dataframe)
|
|
|
thirty_days_before = int(time.time()) - self.THIRTY_DAYS_TIMESTAMP
|
|
|
recent_30_days_df = dataframe[dataframe["publish_time"] >= thirty_days_before]
|
|
|
recent_30_days_analysis = self.analysis_dataframe(recent_30_days_df)
|
|
|
- await self.update_account_stat_detail(
|
|
|
+ return await self.update_account_stat_detail(
|
|
|
account_id, history_articles_analysis, recent_30_days_analysis
|
|
|
)
|
|
|
|
|
@@ -143,5 +144,6 @@ class WeixinAccountManager(CrawlerAccountManager):
|
|
|
if not account_id_list:
|
|
|
account_id_list = await self.get_crawling_accounts(platform=platform)
|
|
|
|
|
|
- for account_id in account_id_list:
|
|
|
+ for account_id in tqdm(account_id_list):
|
|
|
await self.analysis_single_account(account_id)
|
|
|
+
|