feat: 抖音指定创作者done

This commit is contained in:
Relakkes
2024-05-28 01:07:19 +08:00
parent df1e4a7b02
commit 478db4cc4b
8 changed files with 241 additions and 19 deletions

View File

@@ -92,3 +92,31 @@ async def update_dy_aweme_comment(aweme_id: str, comment_item: Dict):
f"[store.douyin.update_dy_aweme_comment] douyin aweme comment: {comment_id}, content: {save_comment_item.get('content')}")
await DouyinStoreFactory.create_store().store_comment(comment_item=save_comment_item)
async def save_creator(user_id: str, creator: Dict):
user_info = creator.get('user', {})
gender_map = {
0: '未知',
1: '',
2: ''
}
avatar_uri = user_info.get('avatar_300x300', {}).get('uri')
local_db_item = {
'user_id': user_id,
'nickname': user_info.get('nickname'),
'gender': gender_map.get(user_info.get('gender'), '未知'),
'avatar': f"https://p3-pc.douyinpic.com/img/{avatar_uri}" + r"~c5_300x300.jpeg?from=2956013662",
'desc': user_info.get('signature'),
'ip_location': user_info.get('ip_location'),
'follows': user_info.get("following_count", 0),
'fans': user_info.get("max_follower_count", 0),
'interaction': user_info.get("total_favorited", 0),
'videos_count': user_info.get("aweme_count", 0),
"last_modify_ts": utils.get_current_timestamp(),
}
utils.logger.info(f"[store.douyin.save_creator] creator:{local_db_item}")
await DouyinStoreFactory.create_store().store_creator(local_db_item)