fix(ImdbSource): API 查询错误重试

This commit is contained in:
wumode
2025-10-23 01:16:32 +08:00
parent 66ce816a31
commit 03a2b35930
3 changed files with 6 additions and 9 deletions

View File

@@ -453,11 +453,12 @@
"name": "IMDb源",
"description": "让探索推荐和媒体识别支持IMDb数据源。",
"labels": "探索",
"version": "1.6.1",
"version": "1.6.2",
"icon": "IMDb_IOS-OSX_App.png",
"author": "wumode",
"level": 1,
"history": {
"v1.6.2": "修复 API 查询错误重试问题",
"v1.6.1": "添加中文主屏幕组件; 修复 bug",
"v1.5.8": "修改UA",
"v1.5.7": "改进异常处理",

View File

@@ -30,7 +30,7 @@ class ImdbSource(_PluginBase):
# 插件图标
plugin_icon = "IMDb_IOS-OSX_App.png"
# 插件版本
plugin_version = "1.6.1"
plugin_version = "1.6.2"
# 插件作者
plugin_author = "wumode"
# 作者主页

View File

@@ -332,7 +332,7 @@ class OfficialApiClient:
self._req = RequestUtils(accept_type="application/json",
content_type="application/json",
timeout=10,
ua=None,
ua=ua,
proxies=proxies,
session=requests.Session())
if proxies:
@@ -457,7 +457,7 @@ class OfficialApiClient:
if title_type in ImdbType._value2member_map_:
title_type_ids.append(title_type)
if len(title_type_ids):
variables["titleTypeConstraint"] = {"anyTitleTypeIds": params.title_types}
variables["titleTypeConstraint"] = {"anyTitleTypeIds": title_type_ids}
if params.genres:
variables["genreConstraint"] = {"allGenreIds": params.genres, "excludeGenreIds": []}
if params.countries:
@@ -504,11 +504,7 @@ class OfficialApiClient:
params = {"operationName": operation_name,
"variables": variables}
try:
data = await self._async_request(params, sha256)
except Exception as e:
logger.debug(f"An error occurred while querying {operation_name}: {e}")
return None
data = await self._async_request(params, sha256)
if not data:
return None
if 'error' in data: