Multi-account
This commit is contained in:
parent
4430f02341
commit
221952a2e0
51
main.py
51
main.py
|
@ -21,7 +21,14 @@ sentry_sdk.init(
|
||||||
)
|
)
|
||||||
|
|
||||||
# Running in Github Action, use this to get the config
|
# Running in Github Action, use this to get the config
|
||||||
config = json.loads(os.environ.get('config'))
|
conf = json.loads(os.environ.get('config'))
|
||||||
|
if type(conf) == type(list()):
|
||||||
|
pass
|
||||||
|
elif type(conf) == type(dict()):
|
||||||
|
ls = []
|
||||||
|
ls.append(conf)
|
||||||
|
conf = ls
|
||||||
|
|
||||||
|
|
||||||
# Options
|
# Options
|
||||||
sct_status = os.environ.get('sct') # https://sct.ftqq.com/
|
sct_status = os.environ.get('sct') # https://sct.ftqq.com/
|
||||||
|
@ -35,26 +42,34 @@ class RunError(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
token = config['token']
|
|
||||||
client_type = config['type']
|
|
||||||
try:
|
try:
|
||||||
ver_info = r.get('https://sdk-static.mihoyo.com/hk4e_cn/mdk/launcher/api/resource?key=eYd89JmJ&launcher_id=18', timeout=60).text
|
ver_info = r.get('https://sdk-static.mihoyo.com/hk4e_cn/mdk/launcher/api/resource?key=eYd89JmJ&launcher_id=18', timeout=60).text
|
||||||
version = json.loads(ver_info)['data']['game']['latest']['version']
|
version = json.loads(ver_info)['data']['game']['latest']['version']
|
||||||
print(f'从官方API获取到云·原神最新版本号:{version}')
|
print(f'从官方API获取到云·原神最新版本号:{version}')
|
||||||
except:
|
except:
|
||||||
version = config['version']
|
version = '3.8.0'
|
||||||
android = config['android']
|
|
||||||
deviceid = config['deviceid']
|
|
||||||
devicename = config['devicename']
|
|
||||||
devicemodel = config['devicemodel']
|
|
||||||
appid = config['appid']
|
|
||||||
|
|
||||||
bbsid = re.findall(r'oi=[0-9]+', token)[0].replace('oi=', '')
|
|
||||||
|
|
||||||
NotificationURL = 'https://api-cloudgame.mihoyo.com/hk4e_cg_cn/gamer/api/listNotifications?status=NotificationStatusUnread&type=NotificationTypePopup&is_sort=true'
|
NotificationURL = 'https://api-cloudgame.mihoyo.com/hk4e_cg_cn/gamer/api/listNotifications?status=NotificationStatusUnread&type=NotificationTypePopup&is_sort=true'
|
||||||
WalletURL = 'https://api-cloudgame.mihoyo.com/hk4e_cg_cn/wallet/wallet/get'
|
WalletURL = 'https://api-cloudgame.mihoyo.com/hk4e_cg_cn/wallet/wallet/get'
|
||||||
AnnouncementURL = 'https://api-cloudgame.mihoyo.com/hk4e_cg_cn/gamer/api/getAnnouncementInfo'
|
AnnouncementURL = 'https://api-cloudgame.mihoyo.com/hk4e_cg_cn/gamer/api/getAnnouncementInfo'
|
||||||
headers = {
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
for config in conf:
|
||||||
|
if config == '':
|
||||||
|
# Verify config
|
||||||
|
raise RunError(
|
||||||
|
f"请在Settings->Secrets->Actions页面中新建名为config的变量,并将你的配置填入后再运行!")
|
||||||
|
else:
|
||||||
|
token = config['token']
|
||||||
|
client_type = config['type']
|
||||||
|
android = config['android']
|
||||||
|
deviceid = config['deviceid']
|
||||||
|
devicename = config['devicename']
|
||||||
|
devicemodel = config['devicemodel']
|
||||||
|
appid = config['appid']
|
||||||
|
if token == '' or android == 0 or deviceid == '' or devicemodel == '' or appid == 0:
|
||||||
|
raise RunError(f'请确认您的配置文件配置正确再运行本程序!')
|
||||||
|
headers = {
|
||||||
'x-rpc-combo_token': token,
|
'x-rpc-combo_token': token,
|
||||||
'x-rpc-client_type': str(client_type),
|
'x-rpc-client_type': str(client_type),
|
||||||
'x-rpc-app_version': str(version),
|
'x-rpc-app_version': str(version),
|
||||||
|
@ -69,16 +84,8 @@ headers = {
|
||||||
'Connection': 'Keep-Alive',
|
'Connection': 'Keep-Alive',
|
||||||
'Accept-Encoding': 'gzip',
|
'Accept-Encoding': 'gzip',
|
||||||
'User-Agent': 'okhttp/4.9.0'
|
'User-Agent': 'okhttp/4.9.0'
|
||||||
}
|
}
|
||||||
|
bbsid = re.findall(r'oi=[0-9]+', token)[0].replace('oi=', '')
|
||||||
if __name__ == '__main__':
|
|
||||||
if config == '':
|
|
||||||
# Verify config
|
|
||||||
raise RunError(
|
|
||||||
f"请在Settings->Secrets->Actions页面中新建名为config的变量,并将你的配置填入后再运行!")
|
|
||||||
else:
|
|
||||||
if token == '' or android == 0 or deviceid == '' or devicemodel == '' or appid == 0:
|
|
||||||
raise RunError(f'请确认您的配置文件配置正确再运行本程序!')
|
|
||||||
wait_time = random.randint(1, 3600) # Random Sleep to Avoid Ban
|
wait_time = random.randint(1, 3600) # Random Sleep to Avoid Ban
|
||||||
print(f'为了避免同一时间签到人数太多导致被官方怀疑,开始休眠 {wait_time} 秒')
|
print(f'为了避免同一时间签到人数太多导致被官方怀疑,开始休眠 {wait_time} 秒')
|
||||||
time.sleep(wait_time)
|
time.sleep(wait_time)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user