From 5c6a63635265cdceca1b2b12db407f0a5b588dab Mon Sep 17 00:00:00 2001 From: peanutsplash Date: Thu, 14 Dec 2023 00:55:06 +0800 Subject: [PATCH] =?UTF-8?q?fix-bug:=E4=BF=AE=E5=A4=8D=E6=8A=96=E9=9F=B3?= =?UTF-8?q?=E8=AF=84=E8=AE=BA=E7=AD=9B=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- media_platform/douyin/client.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/media_platform/douyin/client.py b/media_platform/douyin/client.py index 853faae..2cebc49 100644 --- a/media_platform/douyin/client.py +++ b/media_platform/douyin/client.py @@ -196,8 +196,10 @@ class DOUYINClient: # 在添加评论到结果列表之前进行关键字筛选 if keywords: - filtered_comments = [comment for comment in comments if - not any(keyword in comment.get("text", "") for keyword in keywords)] + filtered_comments = [] + for comment in comments: + if any(keyword in comment.get("text", "") for keyword in keywords): + filtered_comments.append(comment) else: filtered_comments = comments