From 3c72fc48b030862a4e98154d79244abc53616760 Mon Sep 17 00:00:00 2001 From: crpa33 Date: Thu, 27 Mar 2025 23:22:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=9D=E6=8A=A4author=E4=B8=BANone=E4=BD=86?= =?UTF-8?q?=E6=9C=AA=E8=A2=AB=E8=AF=86=E5=88=AB=E7=9A=84=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- media_platform/zhihu/help.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/media_platform/zhihu/help.py b/media_platform/zhihu/help.py index b1454b2..34381e3 100644 --- a/media_platform/zhihu/help.py +++ b/media_platform/zhihu/help.py @@ -192,15 +192,18 @@ class ZhihuExtractor: """ res = ZhihuCreator() - if not author: - return res - if not author.get("id"): - author = author.get("member") - res.user_id = author.get("id") - res.user_link = f"{zhihu_constant.ZHIHU_URL}/people/{author.get('url_token')}" - res.user_nickname = author.get("name") - res.user_avatar = author.get("avatar_url") - res.url_token = author.get("url_token") + try: + if not author: + return res + if not author.get("id"): + author = author.get("member") + res.user_id = author.get("id") + res.user_link = f"{zhihu_constant.ZHIHU_URL}/people/{author.get('url_token')}" + res.user_nickname = author.get("name") + res.user_avatar = author.get("avatar_url") + res.url_token = author.get("url_token") + finally: + pass return res def extract_comments(self, page_content: ZhihuContent, comments: List[Dict]) -> List[ZhihuComment]: