From 149b6bcdc825ad3a5ab6d8871eb0c749ce25eaac Mon Sep 17 00:00:00 2001 From: Relakkes Date: Sun, 3 Mar 2024 19:36:36 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=8A=96=E9=9F=B3?= =?UTF-8?q?=E5=85=B3=E9=94=AE=E8=AF=8D=E6=90=9C=E7=B4=A2=E4=B8=BA=E4=B8=AD?= =?UTF-8?q?=E6=96=87=E7=9A=84=E6=83=85=E5=86=B5=E4=B8=8B=EF=BC=8C=E6=9C=89?= =?UTF-8?q?bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- media_platform/douyin/client.py | 2 +- media_platform/douyin/core.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/media_platform/douyin/client.py b/media_platform/douyin/client.py index 23f4a06..bca4f95 100644 --- a/media_platform/douyin/client.py +++ b/media_platform/douyin/client.py @@ -114,7 +114,7 @@ class DOUYINClient: :return: """ params = { - "keyword": keyword, + "keyword": urllib.parse.quote(keyword), "search_channel": search_channel.value, "sort_type": sort_type.value, "publish_time": publish_time.value, diff --git a/media_platform/douyin/core.py b/media_platform/douyin/core.py index 0787520..1eacf89 100644 --- a/media_platform/douyin/core.py +++ b/media_platform/douyin/core.py @@ -138,7 +138,8 @@ class DouYinCrawler(AbstractCrawler): task = asyncio.create_task( self.get_comments(aweme_id, semaphore), name=aweme_id) task_list.append(task) - await asyncio.wait(task_list) + if len(task_list) > 0 : + await asyncio.wait(task_list) async def get_comments(self, aweme_id: str, semaphore: asyncio.Semaphore) -> None: async with semaphore: