mirror of
https://github.com/xuthus83/LittlePaimon.git
synced 2024-12-16 13:40:53 +08:00
✨ 更新深渊配队
版本,减少深渊、每日材料
图标丢失的可能性
This commit is contained in:
parent
527f15d77d
commit
72dbeb79cf
@ -10,7 +10,7 @@ BASE_API = 'https://www.youchuang.fun'
|
|||||||
TEAM_RATE_API = f'{BASE_API}/gamerole/formationRate'
|
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_API = 'https://api-cloudgame-static.mihoyo.com/hk4e_cg_cn/gamer/api/getFunctionShieldNew?client_type=1'
|
||||||
VERSION = 3.2
|
VERSION = 3.3
|
||||||
HEADERS = {
|
HEADERS = {
|
||||||
'Host': 'www.youchuang.fun',
|
'Host': 'www.youchuang.fun',
|
||||||
'Referer': 'https://servicewechat.com/wxce4dbe0cb0f764b3/91/page-frame.html',
|
'Referer': 'https://servicewechat.com/wxce4dbe0cb0f764b3/91/page-frame.html',
|
||||||
|
@ -73,7 +73,7 @@ class aiorequests:
|
|||||||
size: Optional[Union[Tuple[int, int], float]] = None,
|
size: Optional[Union[Tuple[int, int], float]] = None,
|
||||||
mode: Optional[str] = None,
|
mode: Optional[str] = None,
|
||||||
crop: Optional[Tuple[int, int, int, int]] = None,
|
crop: Optional[Tuple[int, int, int, int]] = None,
|
||||||
**kwargs) -> Union[str, Image.Image]:
|
**kwargs) -> Union[None, Image.Image]:
|
||||||
"""
|
"""
|
||||||
说明:
|
说明:
|
||||||
httpx的get请求封装,获取图片
|
httpx的get请求封装,获取图片
|
||||||
@ -100,9 +100,11 @@ class aiorequests:
|
|||||||
# 不保存安柏计划的问号图标
|
# 不保存安柏计划的问号图标
|
||||||
if resp.headers.get('etag') == 'W/"6363798a-13c7"' or resp.headers.get(
|
if resp.headers.get('etag') == 'W/"6363798a-13c7"' or resp.headers.get(
|
||||||
'content-md5') == 'JeG5b/z8SpViMmO/E9eayA==':
|
'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']:
|
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()
|
resp = resp.read()
|
||||||
img = Image.open(BytesIO(resp))
|
img = Image.open(BytesIO(resp))
|
||||||
except SSLCertVerificationError:
|
except SSLCertVerificationError:
|
||||||
@ -114,9 +116,11 @@ class aiorequests:
|
|||||||
**kwargs)
|
**kwargs)
|
||||||
if resp.headers.get('etag') == 'W/"6363798a-13c7"' or resp.headers.get(
|
if resp.headers.get('etag') == 'W/"6363798a-13c7"' or resp.headers.get(
|
||||||
'content-md5') == 'JeG5b/z8SpViMmO/E9eayA==':
|
'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']:
|
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()
|
resp = resp.read()
|
||||||
img = Image.open(BytesIO(resp))
|
img = Image.open(BytesIO(resp))
|
||||||
if size:
|
if size:
|
||||||
@ -195,6 +199,7 @@ class aiorequests:
|
|||||||
for url in urls:
|
for url in urls:
|
||||||
with contextlib.suppress(Exception):
|
with contextlib.suppress(Exception):
|
||||||
if url is not None:
|
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'<u><y>[资源检查]</y></u>图标资源<m>{name}</m><r>下载失败</r>')
|
logger.opt(colors=True).info(f'<u><y>[资源检查]</y></u>图标资源<m>{name}</m><r>下载失败</r>')
|
||||||
return None
|
return None
|
||||||
|
Loading…
x
Reference in New Issue
Block a user