From a790d72db9798178a04462330baf0798cc5543a4 Mon Sep 17 00:00:00 2001 From: Relakkes Date: Mon, 4 Dec 2023 21:54:12 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=B0=8F=E7=BA=A2?= =?UTF-8?q?=E4=B9=A6=E7=AC=94=E8=AE=B0=E8=8E=B7=E5=8F=96=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E4=B8=8D=E5=AD=98=E5=9C=A8=E7=9A=84=E7=AC=94=E8=AE=B0=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- media_platform/xhs/client.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/media_platform/xhs/client.py b/media_platform/xhs/client.py index 7a60161..1d0c4d6 100644 --- a/media_platform/xhs/client.py +++ b/media_platform/xhs/client.py @@ -133,8 +133,10 @@ class XHSClient: data = {"source_note_id": note_id} uri = "/api/sns/web/v1/feed" res = await self.post(uri, data) - res_dict: Dict = res["items"][0]["note_card"] - return res_dict + if res and res.get("items"): + res_dict: Dict = res["items"][0]["note_card"] + return res_dict + return dict() async def get_note_comments(self, note_id: str, cursor: str = "") -> Dict: """get note comments