diff --git a/LittlePaimon/plugins/Paimon_Abyss/youchuang/api.py b/LittlePaimon/plugins/Paimon_Abyss/youchuang/api.py index 4a5b29a..fefcbe0 100644 --- a/LittlePaimon/plugins/Paimon_Abyss/youchuang/api.py +++ b/LittlePaimon/plugins/Paimon_Abyss/youchuang/api.py @@ -10,7 +10,7 @@ BASE_API = 'https://www.youchuang.fun' TEAM_RATE_API = f'{BASE_API}/gamerole/formationRate' VERSION_API = 'https://api-cloudgame-static.mihoyo.com/hk4e_cg_cn/gamer/api/getFunctionShieldNew?client_type=1' -VERSION = 3.2 +VERSION = 3.3 HEADERS = { 'Host': 'www.youchuang.fun', 'Referer': 'https://servicewechat.com/wxce4dbe0cb0f764b3/91/page-frame.html', diff --git a/LittlePaimon/utils/requests.py b/LittlePaimon/utils/requests.py index a51ad63..9fa2525 100644 --- a/LittlePaimon/utils/requests.py +++ b/LittlePaimon/utils/requests.py @@ -73,7 +73,7 @@ class aiorequests: size: Optional[Union[Tuple[int, int], float]] = None, mode: Optional[str] = None, crop: Optional[Tuple[int, int, int, int]] = None, - **kwargs) -> Union[str, Image.Image]: + **kwargs) -> Union[None, Image.Image]: """ 说明: httpx的get请求封装,获取图片 @@ -100,9 +100,11 @@ class aiorequests: # 不保存安柏计划的问号图标 if resp.headers.get('etag') == 'W/"6363798a-13c7"' or resp.headers.get( 'content-md5') == 'JeG5b/z8SpViMmO/E9eayA==': - save_path = False + # save_path = False + return None if resp.headers.get('Content-Type') not in ['image/png', 'image/jpeg']: - return 'No Such File' + # return 'No Such File' + return None resp = resp.read() img = Image.open(BytesIO(resp)) except SSLCertVerificationError: @@ -114,9 +116,11 @@ class aiorequests: **kwargs) if resp.headers.get('etag') == 'W/"6363798a-13c7"' or resp.headers.get( 'content-md5') == 'JeG5b/z8SpViMmO/E9eayA==': - save_path = False + # save_path = False + return None if resp.headers.get('Content-Type') not in ['image/png', 'image/jpeg']: - return 'No Such File' + # return 'No Such File' + return None resp = resp.read() img = Image.open(BytesIO(resp)) if size: @@ -195,6 +199,7 @@ class aiorequests: for url in urls: with contextlib.suppress(Exception): if url is not None: - return await aiorequests.get_img(url=url, headers=headers, save_path=save_path, **kwargs) + if (img := await aiorequests.get_img(url=url, headers=headers, save_path=save_path, **kwargs)) is not None: + return img logger.opt(colors=True).info(f'[资源检查]图标资源{name}下载失败') return None