这是隔壁论坛发的,Firsty自动刷新的Python脚本
但是不会提取对应的key
通过抓包获取对应的key,在脚本里面进行替换就好了。
import requests import json
# 第一个HTTP请求获取access_token url1 = "https://securetoken.googleapis.com/v1/token?key=AIzaSyAw4dSOEuZNgBWLAiwSAqPJ9qArvSOaZDM" headers1 = { 'Accept-Encoding': 'gzip, deflate, br', 'Accept': '*/*', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Host': 'securetoken.googleapis.com', 'X-Ios-Bundle-Identifier': 'com.firsty.app', 'User-Agent': 'FirebaseAuth.iOS/10.25.0 com.firsty.app/1.0.352 iPad/17.5.1 hw/iPad11_3', 'Accept-Language': 'en', 'X-Client-Version': 'iOS/FirebaseSDK/10.25.0/FirebaseCore-iOS', 'X-Firebase-GMPID': '1:962364472393:ios:fede98035afd07718c1398' } body1 = { "grantType": "refresh_token", "refreshToken": "AMf-vBz7n9WMvp2B8XQ_E3BXG4xmd49pD60Ga5FR8cdJRv4XfwwilH2mpG4H6aUTaOYqFHssRchRdvC8AANTPJ4W7AOWks9_TQocd1gFnFRF5Yzdr7VJKxQw93PwnmGaqy9n_6oq49-fbzNsBx75EfgBmDvv590fh7oMCioAL5ZqT5MqRfSMJuu9U2xU0OHBZ76s_qcAZB1sUzdSp16-oodJNMvHDa5PpVXcF5oO6jh-KqzYLaHwAGXLD415dUxPLTLm4BJntguwP2TiD7GA8fZ3gEHgSIQTCn3jUYp7qcho0_6jn1-lJuh9RNct69jzHXUka3AHGMjDiZ0g2WDK4h1A3xE01ilrY_qrlorUVAWgWQY96mMKzcrGbyC_AB3KZJBb7MALXH2LzWgCMGTKSzza7b9slZC5aY9wxMEat0Nm9f4-FxJB_YE" }
response1 = requests.post(url1, headers=headers1, json=body1)
if response1.status_code == 200: access_token = response1.json().get("access_token") if access_token: # 第二个HTTP请求使用获取到的access_token url2 = "https://backoffice.firsty.app/api/mobile/subscriptions/v2/ypeoTC3zuzPY4AQO1goTi41C5gj1/iccid/893107062434918716/free"
headers2 = { "user-agent": "Dart/3.4 (dart:io)", "accept-encoding": "gzip", "authorization": f"Bearer {access_token}", # 使用获取到的access_token "app-build": "3938", "content-type": "application/json", "app-version": "1.0.352" }
data2 = { "planType": "ADVERTISEMENT", "deviceId": "UKQ123254001", "country": "CN" }
response2 = requests.post(url2, headers=headers2, json=data2)
if response2.status_code == 200: print(response2.json()) else: print(f"第二个请求失败,状态代码为: {response2.status_code}") else: print("在响应中找不到访问令牌Access token") else: print(f"第一个请求失败,状态代码为: {response1.status_code}")
|