From 940cc566c89a045b543b746fa49f0822270615d5 Mon Sep 17 00:00:00 2001 From: InfinityPacer <160988576+InfinityPacer@users.noreply.github.com> Date: Wed, 26 Jun 2024 18:17:31 +0800 Subject: [PATCH] fix douban rate_limit tips --- app/modules/douban/__init__.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/modules/douban/__init__.py b/app/modules/douban/__init__.py index 43917ed3..f63ed112 100644 --- a/app/modules/douban/__init__.py +++ b/app/modules/douban/__init__.py @@ -624,13 +624,16 @@ class DoubanModule(_ModuleBase): # 搜索 logger.info(f"开始使用名称 {name} 匹配豆瓣信息 ...") result = self.doubanapi.search(f"{name} {year or ''}".strip()) - if not result or not result.get("items"): + if not result: logger.warn(f"未找到 {name} 的豆瓣信息") return {} # 触发rate limit if "search_access_rate_limit" in result.values(): - logger.warn(f"触发豆瓣API速率限制 错误信息 {result} ...") - raise Exception("触发豆瓣API速率限制") + logger.warn(f"触发豆瓣API速率限制,错误信息:{result} ...") + return {} + if not result.get("items"): + logger.warn(f"未找到 {name} 的豆瓣信息") + return {} for item_obj in result.get("items"): type_name = item_obj.get("type_name") if type_name not in [MediaType.TV.value, MediaType.MOVIE.value]: