fix: 修复日志打印时参数格式错误

This commit is contained in:
Relakkes 2023-12-22 23:10:44 +08:00
parent bced7f6802
commit 273c9a316b
4 changed files with 4 additions and 4 deletions

View File

@ -176,7 +176,7 @@ class BilibiliCrawler(AbstractCrawler):
except DataFetchError as ex: except DataFetchError as ex:
utils.logger.error(f"[get_comments] get video_id: {video_id} comment error: {ex}") utils.logger.error(f"[get_comments] get video_id: {video_id} comment error: {ex}")
except Exception as e: except Exception as e:
utils.logger.error(f"[get_comments] may be been blocked, err:", e) utils.logger.error(f"[get_comments] may be been blocked, err:{e}")
async def get_specified_videos(self): async def get_specified_videos(self):
""" """

View File

@ -172,7 +172,7 @@ class KuaishouCrawler(AbstractCrawler):
except DataFetchError as ex: except DataFetchError as ex:
utils.logger.error(f"[get_comments] get video_id: {video_id} comment error: {ex}") utils.logger.error(f"[get_comments] get video_id: {video_id} comment error: {ex}")
except Exception as e: except Exception as e:
utils.logger.error(f"[get_comments] may be been blocked, err:", e) utils.logger.error(f"[get_comments] may be been blocked, err:{e}")
# use time.sleeep block main coroutine instead of asyncio.sleep and cacel running comment task # use time.sleeep block main coroutine instead of asyncio.sleep and cacel running comment task
# maybe kuaishou block our request, we will take a nap and update the cookie again # maybe kuaishou block our request, we will take a nap and update the cookie again
current_running_tasks = comment_tasks_var.get() current_running_tasks = comment_tasks_var.get()

View File

@ -136,7 +136,7 @@ class XHSClient:
if res and res.get("items"): if res and res.get("items"):
res_dict: Dict = res["items"][0]["note_card"] res_dict: Dict = res["items"][0]["note_card"]
return res_dict return res_dict
utils.logger.error("[xhs.client.get_note_by_id] get note empty and res:", res) utils.logger.error(f"[xhs.client.get_note_by_id] get note empty and res:{res}")
return dict() return dict()
async def get_note_comments(self, note_id: str, cursor: str = "") -> Dict: async def get_note_comments(self, note_id: str, cursor: str = "") -> Dict:

View File

@ -102,7 +102,7 @@ class XiaoHongShuCrawler(AbstractCrawler):
keyword=keyword, keyword=keyword,
page=page, page=page,
) )
utils.logger.info("Search notes res:", notes_res) utils.logger.info(f"Search notes res:{notes_res}")
semaphore = asyncio.Semaphore(config.MAX_CONCURRENCY_NUM) semaphore = asyncio.Semaphore(config.MAX_CONCURRENCY_NUM)
task_list = [ task_list = [
self.get_note_detail(post_item.get("id"), semaphore) self.get_note_detail(post_item.get("id"), semaphore)