mirror of
https://github.com/NanmiCoder/MediaCrawler.git
synced 2026-10-05 04:58:11 +08:00
feat: 完善类型注释,增加 mypy 类型检测
This commit is contained in:
+4
-4
@@ -1,4 +1,4 @@
|
||||
from typing import Dict
|
||||
from typing import Dict, List
|
||||
|
||||
from tools import utils
|
||||
|
||||
@@ -7,7 +7,7 @@ async def update_xhs_note(note_item: Dict):
|
||||
note_id = note_item.get("note_id")
|
||||
user_info = note_item.get("user", {})
|
||||
interact_info = note_item.get("interact_info")
|
||||
image_list = note_item.get("image_list")
|
||||
image_list: List[Dict]= note_item.get("image_list", [])
|
||||
|
||||
local_db_item = {
|
||||
"note_id": note_item.get("note_id"),
|
||||
@@ -20,7 +20,7 @@ async def update_xhs_note(note_item: Dict):
|
||||
"nickname": user_info.get("nickname"),
|
||||
"avatar": user_info.get("avatar"),
|
||||
"ip_location": note_item.get("ip_location", ""),
|
||||
"image_list": ','.join([img.get('url') for img in image_list]),
|
||||
"image_list": ','.join([img.get('url','') for img in image_list]),
|
||||
"last_modify_ts": utils.get_current_timestamp(),
|
||||
}
|
||||
# do something ...
|
||||
@@ -28,7 +28,7 @@ async def update_xhs_note(note_item: Dict):
|
||||
|
||||
|
||||
async def update_xhs_note_comment(note_id: str, comment_item: Dict):
|
||||
user_info = comment_item.get("user_info")
|
||||
user_info = comment_item.get("user_info", {})
|
||||
comment_id = comment_item.get("id")
|
||||
local_db_item = {
|
||||
"comment_id": comment_id,
|
||||
|
||||
Reference in New Issue
Block a user