|
@@ -107,7 +107,7 @@ class CrawlerGzhFans(CrawlerGzhFansBase):
|
|
|
def __init__(self, pool, log_client):
|
|
def __init__(self, pool, log_client):
|
|
|
super().__init__(pool, log_client)
|
|
super().__init__(pool, log_client)
|
|
|
|
|
|
|
|
- # 抓取单个账号的粉丝
|
|
|
|
|
|
|
+ # 抓取单个账号存量的粉丝
|
|
|
async def crawl_fans_for_each_account(self, account_info):
|
|
async def crawl_fans_for_each_account(self, account_info):
|
|
|
cookie_obj = await self.get_cookie_token_from_database(account_info["gh_id"])
|
|
cookie_obj = await self.get_cookie_token_from_database(account_info["gh_id"])
|
|
|
if not cookie_obj:
|
|
if not cookie_obj:
|
|
@@ -136,6 +136,15 @@ class CrawlerGzhFans(CrawlerGzhFansBase):
|
|
|
match code:
|
|
match code:
|
|
|
case 0:
|
|
case 0:
|
|
|
user_list = response.get("user_list", {}).get("user_info_list")
|
|
user_list = response.get("user_list", {}).get("user_info_list")
|
|
|
|
|
+ if not user_list:
|
|
|
|
|
+ await feishu_robot.bot(
|
|
|
|
|
+ title=f"{account_info['account_name']}的粉丝已经抓取完毕,请检查",
|
|
|
|
|
+ detail=account_info,
|
|
|
|
|
+ env="cookie_monitor_bot",
|
|
|
|
|
+ mention=False,
|
|
|
|
|
+ )
|
|
|
|
|
+ await self.set_cookie_token_as_invalid(account_info["gh_id"])
|
|
|
|
|
+
|
|
|
next_cursor_id = user_list[-1].get("user_openid")
|
|
next_cursor_id = user_list[-1].get("user_openid")
|
|
|
next_cursor_timestamp = user_list[-1].get("user_create_time")
|
|
next_cursor_timestamp = user_list[-1].get("user_create_time")
|
|
|
await self.insert_gzh_fans_batch(account_info, user_list)
|
|
await self.insert_gzh_fans_batch(account_info, user_list)
|
|
@@ -181,9 +190,6 @@ class CrawlerGzhFans(CrawlerGzhFansBase):
|
|
|
# main function
|
|
# main function
|
|
|
async def deal(self):
|
|
async def deal(self):
|
|
|
account_list = await self.get_account_list_from_database()
|
|
account_list = await self.get_account_list_from_database()
|
|
|
- # for account_info in account_list:
|
|
|
|
|
- # # await self.get_union_ids_for_each_account(account_info)
|
|
|
|
|
- # await self.crawl_fans_for_each_account(account_info)
|
|
|
|
|
return await run_tasks_with_asyncio_task_group(
|
|
return await run_tasks_with_asyncio_task_group(
|
|
|
task_list=account_list,
|
|
task_list=account_list,
|
|
|
handler=self.crawl_fans_for_each_account,
|
|
handler=self.crawl_fans_for_each_account,
|