From 95c3293b9751c356e005971131cf6330dd22fa11 Mon Sep 17 00:00:00 2001 From: ravenling Date: Sat, 28 Feb 2026 15:57:55 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dzhihu=E8=AF=84?= =?UTF-8?q?=E8=AE=BA=E7=88=AC=E5=8F=96=E5=88=86=E9=A1=B5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- media_platform/zhihu/client.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/media_platform/zhihu/client.py b/media_platform/zhihu/client.py index 2da5a9d..079d08d 100644 --- a/media_platform/zhihu/client.py +++ b/media_platform/zhihu/client.py @@ -299,8 +299,10 @@ class ZhiHuClient(AbstractApiClient, ProxyRefreshMixin): result: List[ZhihuComment] = [] is_end: bool = False offset: str = "" + prev_offset: str = "" limit: int = 10 while not is_end: + prev_offset = offset root_comment_res = await self.get_root_comments(content.content_id, content.content_type, offset, limit) if not root_comment_res: break @@ -312,6 +314,9 @@ class ZhiHuClient(AbstractApiClient, ProxyRefreshMixin): if not comments: break + if prev_offset == offset: + break + if callback: await callback(comments) @@ -348,8 +353,10 @@ class ZhiHuClient(AbstractApiClient, ProxyRefreshMixin): is_end: bool = False offset: str = "" + prev_offset: str = "" limit: int = 10 while not is_end: + prev_offset = offset child_comment_res = await self.get_child_comments(parment_comment.comment_id, offset, limit) if not child_comment_res: break @@ -361,6 +368,9 @@ class ZhiHuClient(AbstractApiClient, ProxyRefreshMixin): if not sub_comments: break + if prev_offset == offset: + break + if callback: await callback(sub_comments)