mirror of
https://github.com/KimigaiiWuyi/GenshinUID.git
synced 2025-05-07 04:03:45 +08:00
🔥 彻底删除GsCookie
This commit is contained in:
parent
27f7bf7a4e
commit
a3435d4c26
@ -8,7 +8,7 @@ from gsuid_core.logger import logger
|
||||
from gsuid_core.utils.error_reply import get_error_img
|
||||
from gsuid_core.utils.api.mys.models import AbyssBattleAvatar
|
||||
|
||||
from ..utils.convert import GsCookie
|
||||
from ..utils.mys_api import mys_api
|
||||
from ..utils.image.convert import convert_img
|
||||
from ..utils.resource.download_url import download_file
|
||||
from ..utils.resource.generate_char_card import create_single_char_card
|
||||
@ -113,17 +113,15 @@ async def draw_abyss_img(
|
||||
floor: Optional[int] = None,
|
||||
schedule_type: str = '1',
|
||||
) -> Union[bytes, str]:
|
||||
# 获取Cookies
|
||||
data = GsCookie()
|
||||
retcode = await data.get_cookie(uid)
|
||||
if retcode:
|
||||
return retcode
|
||||
raw_data = data.raw_data
|
||||
raw_abyss_data = await data.get_spiral_abyss_data(schedule_type)
|
||||
raw_abyss_data = await mys_api.get_spiral_abyss_info(schedule_type)
|
||||
raw_data = await mys_api.get_info(uid)
|
||||
|
||||
# 获取数据
|
||||
if isinstance(raw_abyss_data, int):
|
||||
return await get_error_img(raw_abyss_data)
|
||||
if isinstance(raw_data, int):
|
||||
return await get_error_img(raw_data)
|
||||
|
||||
if raw_data:
|
||||
char_data = raw_data['avatars']
|
||||
else:
|
||||
|
@ -3,10 +3,7 @@ from typing import Tuple, Union, Optional, overload
|
||||
|
||||
from gsuid_core.bot import Bot
|
||||
from gsuid_core.models import Event
|
||||
from gsuid_core.utils.error_reply import VERIFY_HINT
|
||||
from gsuid_core.utils.api.mys.models import AbyssData, IndexData
|
||||
|
||||
from .mys_api import mys_api
|
||||
from .database import get_sqla
|
||||
|
||||
|
||||
@ -49,58 +46,3 @@ async def get_uid(
|
||||
if get_user_id:
|
||||
return uid, user_id
|
||||
return uid
|
||||
|
||||
|
||||
class GsCookie:
|
||||
def __init__(self) -> None:
|
||||
self.cookie: Optional[str] = None
|
||||
self.uid: str = '0'
|
||||
self.raw_data = None
|
||||
self.sqla = get_sqla('TEMP')
|
||||
|
||||
async def get_cookie(self, uid: str) -> str:
|
||||
self.uid = uid
|
||||
while True:
|
||||
self.cookie = await self.sqla.get_random_cookie(uid)
|
||||
if self.cookie is None:
|
||||
return '没有可以使用的cookie!'
|
||||
await self.get_uid_data()
|
||||
msg = await self.check_cookies_useable()
|
||||
if isinstance(msg, str):
|
||||
return msg
|
||||
elif msg:
|
||||
return ''
|
||||
|
||||
async def get_uid_data(self) -> Union[int, IndexData]:
|
||||
data = await mys_api.get_info(self.uid, self.cookie)
|
||||
if not isinstance(data, int):
|
||||
self.raw_data = data
|
||||
return data
|
||||
|
||||
async def get_spiral_abyss_data(
|
||||
self, schedule_type: str = '1'
|
||||
) -> Union[AbyssData, int]:
|
||||
data = await mys_api.get_spiral_abyss_info(
|
||||
self.uid, schedule_type, self.cookie
|
||||
)
|
||||
return data
|
||||
|
||||
async def check_cookies_useable(self):
|
||||
if isinstance(self.raw_data, int) and self.cookie:
|
||||
retcode = self.raw_data
|
||||
if retcode == 10001:
|
||||
await self.sqla.mark_invalid(self.cookie, 'error')
|
||||
return False
|
||||
# return '您的cookie已经失效, 请重新获取!'
|
||||
elif retcode == 10101:
|
||||
await self.sqla.mark_invalid(self.cookie, 'limit30')
|
||||
return False
|
||||
# return '当前查询CK已超过每日30次上限!'
|
||||
elif retcode == 10102:
|
||||
return '当前查询id已经设置了隐私, 无法查询!'
|
||||
elif retcode == 1034:
|
||||
return VERIFY_HINT
|
||||
else:
|
||||
return f'API报错, 错误码为{retcode}!'
|
||||
else:
|
||||
return True
|
||||
|
1535
poetry.lock
generated
1535
poetry.lock
generated
File diff suppressed because it is too large
Load Diff
@ -1,64 +1,65 @@
|
||||
--index-url https://pypi.mirrors.ustc.edu.cn/simple
|
||||
|
||||
aiofiles==23.1.0 ; python_full_version >= "3.8.1" and python_version < "4.0"
|
||||
aiohttp==3.8.4 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||
aiofiles==23.2.1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||
aiohttp==3.8.5 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||
aiosignal==1.3.1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||
aiosqlite==0.19.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||
anyio==3.7.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||
apscheduler==3.10.1 ; python_full_version >= "3.8.1" and python_version < "4.0"
|
||||
async-timeout==4.0.2 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||
anyio==3.7.1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||
apscheduler==3.10.4 ; python_full_version >= "3.8.1" and python_version < "4.0"
|
||||
async-timeout==4.0.3 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||
attrs==23.1.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||
backports-zoneinfo==0.2.1 ; python_full_version >= "3.8.1" and python_version < "3.9"
|
||||
bcrypt==4.0.1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||
beautifulsoup4==4.12.2 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||
certifi==2023.5.7 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||
charset-normalizer==3.1.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||
casbin==1.28.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||
certifi==2023.7.22 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||
charset-normalizer==3.2.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||
colorama==0.4.6 ; python_full_version >= "3.8.1" and python_version < "4.0" and (platform_system == "Windows" or sys_platform == "win32")
|
||||
dnspython==2.3.0 ; python_full_version >= "3.8.1" and python_version < "4.0"
|
||||
email-validator==2.0.0.post2 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||
dnspython==2.4.2 ; python_full_version >= "3.8.1" and python_version < "4.0"
|
||||
email-validator==1.3.1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||
et-xmlfile==1.1.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||
exceptiongroup==1.1.1 ; python_full_version >= "3.8.1" and python_version < "3.11"
|
||||
fastapi-amis-admin==0.5.7 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||
fastapi-user-auth==0.5.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||
fastapi==0.97.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||
frozenlist==1.3.3 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||
exceptiongroup==1.1.3 ; python_full_version >= "3.8.1" and python_version < "3.11"
|
||||
fastapi-amis-admin==0.6.6 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||
fastapi-user-auth==0.6.1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||
fastapi==0.103.1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||
frozenlist==1.4.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||
gitdb==4.0.10 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||
gitpython==3.1.31 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||
gitpython==3.1.36 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||
greenlet==2.0.2 ; python_full_version >= "3.8.1" and (platform_machine == "win32" or platform_machine == "WIN32" or platform_machine == "AMD64" or platform_machine == "amd64" or platform_machine == "x86_64" or platform_machine == "ppc64le" or platform_machine == "aarch64") and python_full_version < "4.0.0"
|
||||
h11==0.14.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||
httpcore==0.17.2 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||
httpx==0.24.1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||
httpcore==0.18.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||
httpx==0.25.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||
idna==3.4 ; python_full_version >= "3.8.1" and python_version < "4.0"
|
||||
loguru==0.6.0 ; python_full_version >= "3.8.1" and python_version < "4.0"
|
||||
lxml==4.9.2 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||
msgspec==0.16.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||
loguru==0.7.2 ; python_full_version >= "3.8.1" and python_version < "4.0"
|
||||
lxml==4.9.3 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||
msgspec==0.18.2 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||
multidict==6.0.4 ; python_full_version >= "3.8.1" and python_version < "4.0"
|
||||
nonebot-plugin-apscheduler==0.2.0 ; python_full_version >= "3.8.1" and python_version < "4.0"
|
||||
nonebot2==2.0.0rc4 ; python_full_version >= "3.8.1" and python_version < "4.0"
|
||||
nonebot-plugin-apscheduler==0.3.0 ; python_full_version >= "3.8.1" and python_version < "4.0"
|
||||
nonebot2==2.1.0 ; python_full_version >= "3.8.1" and python_version < "4.0"
|
||||
openpyxl==3.1.2 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||
passlib==1.7.4 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||
pillow==9.5.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||
pydantic==1.10.9 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||
pydantic[dotenv]==1.10.9 ; python_full_version >= "3.8.1" and python_version < "4.0"
|
||||
pillow==10.0.1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||
pydantic==1.10.12 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||
pydantic[dotenv]==1.10.12 ; python_full_version >= "3.8.1" and python_version < "4.0"
|
||||
pygtrie==2.5.0 ; python_full_version >= "3.8.1" and python_version < "4.0"
|
||||
pypng==0.20220715.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||
python-dotenv==1.0.0 ; python_full_version >= "3.8.1" and python_version < "4.0"
|
||||
python-multipart==0.0.6 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||
pytz==2023.3 ; python_full_version >= "3.8.1" and python_version < "4.0"
|
||||
pytz==2023.3.post1 ; python_full_version >= "3.8.1" and python_version < "4.0"
|
||||
qrcode[pil]==7.4.2 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||
setuptools==67.8.0 ; python_full_version >= "3.8.1" and python_version < "4.0"
|
||||
simpleeval==0.9.13 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||
six==1.16.0 ; python_full_version >= "3.8.1" and python_version < "4.0"
|
||||
smmap==5.0.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||
smmap==5.0.1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||
sniffio==1.3.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||
soupsieve==2.4.1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||
sqlalchemy-database==0.1.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||
sqlalchemy2-stubs==0.0.2a34 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||
soupsieve==2.5 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||
sqlalchemy-database==0.1.1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||
sqlalchemy2-stubs==0.0.2a35 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||
sqlalchemy==1.4.41 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||
sqlmodel==0.0.8 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||
sqlmodelx==0.0.5 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||
starlette==0.27.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
|
||||
tomli==2.0.1 ; python_full_version >= "3.8.1" and python_version < "3.11"
|
||||
typing-extensions==4.6.3 ; python_full_version >= "3.8.1" and python_version < "4.0"
|
||||
typing-extensions==4.8.0 ; python_full_version >= "3.8.1" and python_version < "4.0"
|
||||
tzdata==2023.3 ; python_full_version >= "3.8.1" and python_version < "4.0" and platform_system == "Windows"
|
||||
tzlocal==5.0.1 ; python_full_version >= "3.8.1" and python_version < "4.0"
|
||||
win32-setctime==1.1.0 ; python_full_version >= "3.8.1" and python_version < "4.0" and sys_platform == "win32"
|
||||
|
Loading…
x
Reference in New Issue
Block a user