感觉大部分人都是用脚本抢的,手抢根本没希望。随便弄了一个脚本,大家自己搞着玩
抓包云原神apk,点击登录应该可以拿到三个请求,基本上只要模拟最后一个就行
import requests
import time
uid: str = ""
token: str = ""
sign: str = ""
si: str = ""
device_id1: str = ""
device_id2: str = ""
sys_version: str = ""
device_model: str = ""
mdk_version: str = ""
language = ""
device_name = ""
channel_id = ""
client_type = ""
channel_version = ""
ua = "okhttp/3.10.0"
game_biz = "hk4e_cn"
app_id = ""
def ys_signin():
url = "https://hk4e-sdk.mihoyo.com/hk4e_cn/mdk/shield/api/verify"
headers = {
# "Accept": "application/json",
# "Accept-Encoding": "gzip",
"x-rpc-sys_version": sys_version,
"x-rpc-device_id": device_id1,
"x-rpc-device_model": device_model,
"x-rpc-device_name": device_name,
"x-rpc-client_type": client_type,
"x-rpc-mdk_version": mdk_version,
"x-rpc-game_biz": game_biz,
"x-rpc-language": language,
"x-rpc-channel_version": channel_version,
"x-rpc-channel_id": channel_id,
"Content-Type": "application/json",
# "Content-Length": "62",
# "Host": "hk4e-sdk.mihoyo.com",
# "Connection": "Keep-Alive",
"User-Agent": ua
}
body = {
"uid": uid,
"token": token
}
resp = requests.post(url, json=body, headers=headers)
print(resp.json())
def ys_get_combo_token():
url = "https://hk4e-sdk.mihoyo.com/hk4e_cn/combo/granter/login/v2/login"
headers = {
"x-rpc-sys_version": sys_version,
"x-rpc-device_model": device_model,
"x-rpc-device_id": device_id1,
"x-rpc-mdk_version": mdk_version,
"x-rpc-channel_id": channel_id,
"x-rpc-language": language,
"x-rpc-channel_version": channel_version,
"x-rpc-device_name": device_name,
"x-rpc-client_type": client_type,
"platform": "true",
# "Accept-Encoding": "gzip",
"Content-Type": "application/json; charset=utf-8",
# "Content-Length": "225",
# "Host": "hk4e-sdk.mihoyo.com",
# "Connection": "Keep-Alive",
"User-Agent": ua
}
data = '{"uid":"%s","token":"%s","guest":false}' % (uid, token)
body = {
"app_id": app_id,
"device": device_id1,
"channel_id": channel_id,
"sign": sign,
"data": data
}
resp = requests.post(url, json=body, headers=headers)
return resp.json()["data"]["combo_token"]
def ys_login(ct):
url = "https://api-cloudgame.mihoyo.com/hk4e_cg_cn/gamer/api/login"
# 看情况自己改headers,不知道为什么跟前面不一样
headers = {
"x-rpc-combo_token": "ai=%s;ci=%s;oi=%s;ct=%s;si=%s;bi=%s" % (app_id, channel_id, uid, ct, si, game_biz),
"x-rpc-client_type": "2",
"x-rpc-app_version": "1.0.0",
"x-rpc-sys_version": sys_version,
"x-rpc-channel": "mihoyo",
"x-rpc-device_id": device_id2,
"x-rpc-device_name": "",
"x-rpc-device_model": "",
"x-rpc-app_id": "",
"Referer": "https://app.mihoyo.com",
"Content-Length": "0",
"Host": "api-cloudgame.mihoyo.com",
"Connection": "Keep-Alive",
"Accept-Encoding": "gzip",
"User-Agent": "okhttp/3.14.9"
}
resp = requests.post(url, headers=headers)
return resp.json()
count: int = 0
# 日期自己看情况,小于号意味着当时间小于后面的值时,不发出请求,大于后面的值时才开始不断请求
while time.strftime('%Y/%m/%d %H:%M:%S') < "2021/08/19 11:58:30":
time.sleep(0.05)
print(time.strftime('%Y/%m/%d %H:%M:%S'))
while True:
# ct很可能不会变,因此可以改一改
ct = ys_get_combo_token()
print(ct)
try:
resp = ys_login(ct)
print(resp)
# 时间自己找个合适的
time.sleep(5)
except KeyboardInterrupt:
break
except:
print("网络不佳")
pass
评论 (0)