From 384bf4e7dcd6339cce86fbbfd8cf2f12cbecc67c Mon Sep 17 00:00:00 2001 From: RBAmeto <46624927+RBAmeto@users.noreply.github.com> Date: Thu, 18 May 2023 11:58:32 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=E5=86=8D=E6=AC=A1=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E9=AA=8C=E8=AF=81=E7=A0=81=E9=97=AE=E9=A2=98=E4=BB=A5?= =?UTF-8?q?=E5=8F=8A=E6=8A=BD=E5=8D=A1=E8=AE=B0=E5=BD=95=E7=BB=98=E5=9B=BE?= =?UTF-8?q?=E9=87=8D=E5=8F=A0bug=20(#35)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../starrailuid_gachalog/draw_gachalogs.py | 4 ++-- StarRailUID/utils/mys_api.py | 18 +++--------------- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/StarRailUID/starrailuid_gachalog/draw_gachalogs.py b/StarRailUID/starrailuid_gachalog/draw_gachalogs.py index 7cf9b0e..8f26428 100644 --- a/StarRailUID/starrailuid_gachalog/draw_gachalogs.py +++ b/StarRailUID/starrailuid_gachalog/draw_gachalogs.py @@ -406,7 +406,7 @@ async def draw_gachalogs_img(uid: str, user_id: str) -> Union[bytes, str]: 'mm', ) y_extend += ( - (1 + ((total_data[type_list[index - 1]]['total'] - 1) // 5)) * 165 + (1 + ((total_data[type_list[index - 1]]['total'] - 1) // 5)) * 150 if index != 0 else 0 ) @@ -415,7 +415,7 @@ async def draw_gachalogs_img(uid: str, user_id: str) -> Union[bytes, str]: tasks = [] for item_index, item in enumerate(total_data[i]['list']): item_x = (item_index % 5) * 138 + 25 - item_y = (item_index // 5) * 150 + y + 355 + item_y = (item_index // 5) * 170 + y + 355 xy_point = (item_x, item_y) tasks.append( _draw_card( diff --git a/StarRailUID/utils/mys_api.py b/StarRailUID/utils/mys_api.py index 2a1deec..43cb2f7 100644 --- a/StarRailUID/utils/mys_api.py +++ b/StarRailUID/utils/mys_api.py @@ -36,23 +36,11 @@ RECOGNIZE_SERVER = { class MysApi(_MysApi): - mysVersion = '2.44.1' - _HEADER = { - 'x-rpc-app_version': mysVersion, - 'User-Agent': ( - 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) ' - f'AppleWebKit/605.1.15 (KHTML, like Gecko) miHoYoBBS/{mysVersion}' - ), - 'x-rpc-client_type': '5', - 'x-rpc-device_id': uuid.uuid4().hex, - 'x-rpc-device_fp': random_hex(16), - 'x-rpc-page': '3.1.3_#/rpg', - 'Referer': 'https://webstatic.mihoyo.com/', - 'Origin': 'https://webstatic.mihoyo.com', - } - def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) + self._HEADER['x-rpc-device_id'] = uuid.uuid4().hex + self._HEADER['x-rpc-device_fp'] = random_hex(14) + self._HEADER['x-rpc-page'] = '3.1.3_#/rpg' async def create_qrcode_url(self) -> Union[Dict, int]: device_id: str = ''.join(random.choices(ascii_letters + digits, k=64))