Closed SC0624a closed 7 months ago
如题,详情如下(python 3.11.8)
import requests as fw import time class times: def ss(): time_stamp = time.time() return int(time_stamp) def ms(): time_stamp = time.time() return round(time_stamp * 1000) def mihayou_index(phon_id): url = f"https://webapi.account.mihoyo.com/Api/create_mmt?scene_type=1&now={times.ms()}&reason=user.mihoyo.com%2523%252Flogin%252Fcaptcha&action_type=login_by_mobile_captcha" a = fw.get(url) k = a.json()["data"]["mmt_data"]["mmt_key"] t = a.json()["data"]["mmt_type"] if t == 1: print("尝试人机验证\n请您稍后再试") elif k != "": send_mihayou_msg(mmt_key=k,mobile=phon_id) print(k + "\n" + phon_id + "\n" + str(t)) else: print(a.json()) def send_mihayou_msg(mmt_key,mobile): ua = "Mozilla/5.0 (Linux; Android 5.1.1; vivo X9 Plus Build/LMY48Z) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/39.0.0.0 Mobile Safari/537.36" url = f"https://webapi.account.mihoyo.com/Api/create_mobile_captcha action_type=login&mmt_key={mmt_key}&mobile={mobile}%&t={times.ms()}" data = {"User-Agent":ua} a = fw.post(url,json=data) if a.json()["data"]["status"] == -454: print("失败") else: try: msg = a.json()["data"]["msg"] print(msg + "\n成功") except KeyError: print(a.json()) mihayou_index(phon_id="XXXXX")
返回如下
{'code': 400, 'data': {'status': -404}}
如题,详情如下(python 3.11.8)
返回如下
{'code': 400, 'data': {'status': -404}}