diff --git a/mihoyobbs.py b/mihoyobbs.py index 69d8d2b..ccc371f 100644 --- a/mihoyobbs.py +++ b/mihoyobbs.py @@ -20,7 +20,7 @@ class Mihoyobbs: "DS": tools.get_ds(web=False), "cookie": f'stuid={config.config["account"]["stuid"]};stoken={config.config["account"]["stoken"]}', "x-rpc-client_type": setting.mihoyobbs_Client_type, - "x-rpc-app_version": setting.mihoyobbs_Version, + "x-rpc-app_version": setting.mihoyobbs_version, "x-rpc-sys_version": "12", "x-rpc-channel": "miyousheluodi", "x-rpc-device_id": tools.get_device_id(), diff --git a/setting.py b/setting.py index 9c8afe9..22e772b 100644 --- a/setting.py +++ b/setting.py @@ -1,9 +1,10 @@ # 米游社的Salt -mihoyobbs_Salt = "PVeGWIZACpxXZ1ibMVJPi9inCY4Nd4y2" -mihoyobbs_Salt2 = "t0qEgfub6cvueAPgR5m9aQWWVciEer7v" -mihoyobbs_Salt_web = "yUZ3s0Sna1IrSNfk29Vo6vRapdOyqyhB" +mihoyobbs_salt = "TsmyHpZg8gFAVKTtlPaL6YwMldzxZJxQ" +mihoyobbs_salt_x4 = "xV8v4Qu54lUKrEYFZkJhB8cuOh9Asafs" +mihoyobbs_salt_x6 = "t0qEgfub6cvueAPgR5m9aQWWVciEer7v" +mihoyobbs_salt_web = "osgT0DljLarYxgebPPHJFjdaxPfoiHGt" # 米游社的版本 -mihoyobbs_Version = "2.38.1" # Salt和Version相互对应 +mihoyobbs_version = "2.41.2" # Salt和Version相互对应 # 米游社的客户端类型 mihoyobbs_Client_type = "2" # 1为ios 2为安卓 mihoyobbs_Client_type_web = "5" # 4为pc web 5为mobile web @@ -70,9 +71,9 @@ headers = { 'DS': "", "x-rpc-channel": "miyousheluodi", 'Origin': 'https://webstatic.mihoyo.com', - 'x-rpc-app_version': mihoyobbs_Version, + 'x-rpc-app_version': mihoyobbs_version, 'User-Agent': 'Mozilla/5.0 (Linux; Android 12; Unspecified Device) AppleWebKit/537.36 (KHTML, like Gecko) ' - f'Version/4.0 Chrome/103.0.5060.129 Mobile Safari/537.36 miHoYoBBS/{mihoyobbs_Version}', + f'Version/4.0 Chrome/103.0.5060.129 Mobile Safari/537.36 miHoYoBBS/{mihoyobbs_version}', 'x-rpc-client_type': mihoyobbs_Client_type_web, 'Referer': '', 'Accept-Encoding': 'gzip, deflate', diff --git a/tools.py b/tools.py index 7ce6857..805caee 100644 --- a/tools.py +++ b/tools.py @@ -27,9 +27,9 @@ def timestamp() -> int: # 获取请求Header里的DS 当web为true则生成网页端的DS def get_ds(web: bool) -> str: if web: - n = setting.mihoyobbs_Salt_web + n = setting.mihoyobbs_salt_web else: - n = setting.mihoyobbs_Salt + n = setting.mihoyobbs_salt i = str(timestamp()) r = random_text(6) c = md5("salt=" + n + "&t=" + i + "&r=" + r) @@ -38,7 +38,7 @@ def get_ds(web: bool) -> str: # 获取请求Header里的DS(版本2) 这个版本ds之前见到都是查询接口里的 def get_ds2(q: str, b: str) -> str: - n = setting.mihoyobbs_Salt2 + n = setting.mihoyobbs_salt_x6 i = str(timestamp()) r = str(random.randint(100001, 200000)) add = f'&b={b}&q={q}' @@ -73,8 +73,8 @@ def get_useragent() -> str: i = config.config["games"]["cn"]["useragent"].index("miHoYoBBS") if config.config["games"]["cn"]["useragent"][i - 1] == " ": i = i-1 - return f'{config.config["games"]["cn"]["useragent"][:i]} miHoYoBBS/{setting.mihoyobbs_Version}' - return f'{config.config["games"]["cn"]["useragent"]} miHoYoBBS/{setting.mihoyobbs_Version}' + return f'{config.config["games"]["cn"]["useragent"][:i]} miHoYoBBS/{setting.mihoyobbs_version}' + return f'{config.config["games"]["cn"]["useragent"]} miHoYoBBS/{setting.mihoyobbs_version}' # 获取Openssl版本