From 273c9a316b7b5a03495b401bd78301f65a10ac57 Mon Sep 17 00:00:00 2001 From: Relakkes Date: Fri, 22 Dec 2023 23:10:44 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E6=89=93=E5=8D=B0=E6=97=B6=E5=8F=82=E6=95=B0=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- media_platform/bilibili/core.py | 2 +- media_platform/kuaishou/core.py | 2 +- media_platform/xhs/client.py | 2 +- media_platform/xhs/core.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/media_platform/bilibili/core.py b/media_platform/bilibili/core.py index af7aa0b..fbd0651 100644 --- a/media_platform/bilibili/core.py +++ b/media_platform/bilibili/core.py @@ -176,7 +176,7 @@ class BilibiliCrawler(AbstractCrawler): except DataFetchError as ex: utils.logger.error(f"[get_comments] get video_id: {video_id} comment error: {ex}") 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): """ diff --git a/media_platform/kuaishou/core.py b/media_platform/kuaishou/core.py index f3f55a2..b1ed310 100644 --- a/media_platform/kuaishou/core.py +++ b/media_platform/kuaishou/core.py @@ -172,7 +172,7 @@ class KuaishouCrawler(AbstractCrawler): except DataFetchError as ex: utils.logger.error(f"[get_comments] get video_id: {video_id} comment error: {ex}") 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 # maybe kuaishou block our request, we will take a nap and update the cookie again current_running_tasks = comment_tasks_var.get() diff --git a/media_platform/xhs/client.py b/media_platform/xhs/client.py index 698534b..1d96986 100644 --- a/media_platform/xhs/client.py +++ b/media_platform/xhs/client.py @@ -136,7 +136,7 @@ class XHSClient: if res and res.get("items"): res_dict: Dict = res["items"][0]["note_card"] 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() async def get_note_comments(self, note_id: str, cursor: str = "") -> Dict: diff --git a/media_platform/xhs/core.py b/media_platform/xhs/core.py index c4862bb..a33c929 100644 --- a/media_platform/xhs/core.py +++ b/media_platform/xhs/core.py @@ -102,7 +102,7 @@ class XiaoHongShuCrawler(AbstractCrawler): keyword=keyword, 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) task_list = [ self.get_note_detail(post_item.get("id"), semaphore)