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: