From 81a83dc525d8bbb61022d27f56a0ba11de971ea9 Mon Sep 17 00:00:00 2001 From: Neko Aria <990879119@qq.com> Date: Sun, 31 Jul 2022 19:54:02 +0800 Subject: [PATCH] =?UTF-8?q?fix(saucenao):=20=E5=BD=93=20`=5Fget=5Ftitle`?= =?UTF-8?q?=20=E5=9C=A8=E9=81=87=E5=88=B0=E8=8E=B7=E5=8F=96=E5=88=B0=20Non?= =?UTF-8?q?e=20=E6=97=B6=E8=BF=94=E5=9B=9E=E7=A9=BA=E5=AD=97=E7=AC=A6?= =?UTF-8?q?=E4=B8=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PicImageSearch/model/saucenao.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/PicImageSearch/model/saucenao.py b/PicImageSearch/model/saucenao.py index a384f6dd..dc7d966f 100644 --- a/PicImageSearch/model/saucenao.py +++ b/PicImageSearch/model/saucenao.py @@ -18,8 +18,8 @@ def __init__(self, data: Dict[str, Any]): self.member_id: int = result_data.get("member_id", 0) @staticmethod - def _get_title(data: Dict[str, Any]) -> Union[str, Any]: - return next( + def _get_title(data: Dict[str, Any]) -> str: + title = next( ( data[i] for i in [ @@ -34,6 +34,9 @@ def _get_title(data: Dict[str, Any]) -> Union[str, Any]: ), "", ) + if title is None: + title = "" + return title @staticmethod def _get_url(data: Dict[str, Any]) -> Union[str, Any]: