From 2ec220572a53d3bcb14108588c01720792c58087 Mon Sep 17 00:00:00 2001 From: KimigaiiWuyi <444835641@qq.com> Date: Mon, 7 Oct 2024 01:24:26 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20=E4=BF=AE=E5=A4=8D=E5=81=B6?= =?UTF-8?q?=E5=8F=91=E6=83=85=E5=86=B5=E4=B8=8B=E7=9A=84`sr=E5=AF=BC?= =?UTF-8?q?=E5=85=A5=E6=8A=BD=E5=8D=A1=E9=93=BE=E6=8E=A5`=E6=8F=90?= =?UTF-8?q?=E7=A4=BAauthkey=E5=A4=B1=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../starrailuid_gachalog/get_gachalogs.py | 18 ++++++++++++------ StarRailUID/utils/mys_api.py | 8 +++++--- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/StarRailUID/starrailuid_gachalog/get_gachalogs.py b/StarRailUID/starrailuid_gachalog/get_gachalogs.py index 6fd5c9f..eec23cf 100644 --- a/StarRailUID/starrailuid_gachalog/get_gachalogs.py +++ b/StarRailUID/starrailuid_gachalog/get_gachalogs.py @@ -1,15 +1,15 @@ -import asyncio -from datetime import datetime import json +import asyncio from pathlib import Path -from typing import Dict, List, Optional from urllib import parse +from datetime import datetime +from typing import Dict, List, Optional import msgspec -from ..sruid_utils.api.mys.models import SingleGachaLog from ..utils.mys_api import mys_api from ..utils.resource.RESOURCE_PATH import PLAYER_PATH +from ..sruid_utils.api.mys.models import SingleGachaLog gacha_type_meta_data = { "群星跃迁": ["1"], @@ -32,9 +32,15 @@ async def get_new_gachalog_by_link( url_parse = parse.parse_qs(url.query) if "authkey" not in url_parse: return {} - authkey = parse.quote(url_parse["authkey"][0], safe='') + authkey = url_parse["authkey"][0] + authkey = parse.quote(authkey, safe='') + if 'gacha_id' in url_parse: + gacha_id = url_parse["gacha_id"][0] + else: + gacha_id = None + data = await mys_api.get_gacha_log_by_link_in_authkey( - uid, authkey, gacha_type, page, end_id + uid, authkey, gacha_type, page, end_id, gacha_id ) if isinstance(data, int): return {} diff --git a/StarRailUID/utils/mys_api.py b/StarRailUID/utils/mys_api.py index 557f9b0..139436f 100644 --- a/StarRailUID/utils/mys_api.py +++ b/StarRailUID/utils/mys_api.py @@ -161,8 +161,11 @@ class MysApi(_MysApi): gacha_type: str = "11", page: int = 1, end_id: str = "0", + gacha_id: Optional[str] = None, ) -> Union[int, GachaLog]: server_id = RECOGNIZE_SERVER.get(str(uid)[0]) + if gacha_id is None: + gacha_id = "b06a52bc37892e08837b112d28229cebca6b24a2" if self.check_os(uid): HEADER = copy.deepcopy(self._HEADER_OS) ck = await self.get_sr_ck(uid, "OWNER") @@ -178,7 +181,7 @@ class MysApi(_MysApi): url = self.MAPI["STAR_RAIL_GACHA_LOG_URL"] game_biz = "hkrpg_cn" data = await self._mys_request( - url=url, + url=url + f'?authkey={authkey}', method="GET", header=header, params={ @@ -186,12 +189,11 @@ class MysApi(_MysApi): "sign_type": "2", "auth_appid": "webview_gacha", "default_gacha_type": 11, - "gacha_id": "dbebc8d9fbb0d4ffa067423482ce505bc5ea", + "gacha_id": gacha_id, "timestamp": str(int(time.time())), "lang": "zh-cn", "plat_type": "pc", "region": server_id, - "authkey": authkey, "game_biz": game_biz, "gacha_type": gacha_type, "page": page,