mirror of
https://github.com/NanmiCoder/MediaCrawler.git
synced 2026-03-19 01:37:37 +08:00
temp commit
This commit is contained in:
@@ -23,6 +23,19 @@ class TieBaStoreFactory:
|
||||
"[TieBaStoreFactory.create_store] Invalid save option only supported csv or db or json ...")
|
||||
return store_class()
|
||||
|
||||
async def batch_update_tieba_notes(note_list: List[TiebaNote]):
|
||||
"""
|
||||
Batch update tieba notes
|
||||
Args:
|
||||
note_list:
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
if not note_list:
|
||||
return
|
||||
for note_item in note_list:
|
||||
await update_tieba_note(note_item)
|
||||
|
||||
async def update_tieba_note(note_item: TiebaNote):
|
||||
"""
|
||||
@@ -71,3 +84,29 @@ async def update_tieba_note_comment(note_id: str, comment_item: TiebaComment):
|
||||
save_comment_item.update({"last_modify_ts": utils.get_current_timestamp()})
|
||||
utils.logger.info(f"[store.tieba.update_tieba_note_comment] tieba note id: {note_id} comment:{save_comment_item}")
|
||||
await TieBaStoreFactory.create_store().store_comment(save_comment_item)
|
||||
|
||||
|
||||
async def save_creator(user_id: str, user_info: Dict):
|
||||
"""
|
||||
Save creator information to local
|
||||
Args:
|
||||
user_id:
|
||||
user_info:
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
local_db_item = {
|
||||
'user_id': user_id,
|
||||
'nickname': user_info.get('nickname'),
|
||||
'gender': '女' if user_info.get('gender') == "f" else '男',
|
||||
'avatar': user_info.get('avatar'),
|
||||
'ip_location': user_info.get("ip_location", ""),
|
||||
'follows': user_info.get('follow_count', ''),
|
||||
'fans': user_info.get('followers_count', ''),
|
||||
'follow_tieba_list': user_info.get("tieba_list", ''),
|
||||
'last_modify_ts': utils.get_current_timestamp(),
|
||||
'registration_duration': user_info.get("registration_duration", ""),
|
||||
}
|
||||
utils.logger.info(f"[store.tieba.save_creator] creator:{local_db_item}")
|
||||
await TieBaStoreFactory.create_store().store_creator(local_db_item)
|
||||
Reference in New Issue
Block a user