Multi-account
This commit is contained in:
parent
4430f02341
commit
221952a2e0
45
main.py
45
main.py
|
@ -21,7 +21,14 @@ sentry_sdk.init(
|
|||
)
|
||||
|
||||
# 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
|
||||
sct_status = os.environ.get('sct') # https://sct.ftqq.com/
|
||||
|
@ -35,25 +42,33 @@ class RunError(Exception):
|
|||
pass
|
||||
|
||||
|
||||
token = config['token']
|
||||
client_type = config['type']
|
||||
try:
|
||||
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']
|
||||
print(f'从官方API获取到云·原神最新版本号:{version}')
|
||||
except:
|
||||
version = config['version']
|
||||
version = '3.8.0'
|
||||
|
||||
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'
|
||||
AnnouncementURL = 'https://api-cloudgame.mihoyo.com/hk4e_cg_cn/gamer/api/getAnnouncementInfo'
|
||||
|
||||
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']
|
||||
|
||||
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'
|
||||
WalletURL = 'https://api-cloudgame.mihoyo.com/hk4e_cg_cn/wallet/wallet/get'
|
||||
AnnouncementURL = 'https://api-cloudgame.mihoyo.com/hk4e_cg_cn/gamer/api/getAnnouncementInfo'
|
||||
if token == '' or android == 0 or deviceid == '' or devicemodel == '' or appid == 0:
|
||||
raise RunError(f'请确认您的配置文件配置正确再运行本程序!')
|
||||
headers = {
|
||||
'x-rpc-combo_token': token,
|
||||
'x-rpc-client_type': str(client_type),
|
||||
|
@ -70,15 +85,7 @@ headers = {
|
|||
'Accept-Encoding': 'gzip',
|
||||
'User-Agent': 'okhttp/4.9.0'
|
||||
}
|
||||
|
||||
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'请确认您的配置文件配置正确再运行本程序!')
|
||||
bbsid = re.findall(r'oi=[0-9]+', token)[0].replace('oi=', '')
|
||||
wait_time = random.randint(1, 3600) # Random Sleep to Avoid Ban
|
||||
print(f'为了避免同一时间签到人数太多导致被官方怀疑,开始休眠 {wait_time} 秒')
|
||||
time.sleep(wait_time)
|
||||
|
|
Loading…
Reference in New Issue
Block a user