2022-08-27 13:51:38 +00:00
|
|
|
|
import tools
|
|
|
|
|
import config
|
2022-08-28 09:31:01 +00:00
|
|
|
|
import setting
|
|
|
|
|
from request import http
|
2022-08-27 13:51:38 +00:00
|
|
|
|
from loghelper import log
|
|
|
|
|
|
|
|
|
|
|
2022-08-28 09:31:01 +00:00
|
|
|
|
class CloudGenshin:
|
|
|
|
|
def __init__(self) -> None:
|
2022-08-27 13:51:38 +00:00
|
|
|
|
self.headers = {
|
2022-08-28 09:31:01 +00:00
|
|
|
|
'x-rpc-combo_token': config.config['cloud_games']['genshin']['token'],
|
2022-08-27 13:51:38 +00:00
|
|
|
|
'x-rpc-client_type': setting.mihoyobbs_Client_type,
|
|
|
|
|
'x-rpc-app_version': setting.cloudgenshin_Version,
|
2022-08-28 09:31:01 +00:00
|
|
|
|
'x-rpc-sys_version': '12',
|
2022-08-27 13:51:38 +00:00
|
|
|
|
'x-rpc-channel': 'mihoyo',
|
2022-08-27 14:13:05 +00:00
|
|
|
|
'x-rpc-device_id': tools.get_device_id(),
|
2022-08-27 13:51:38 +00:00
|
|
|
|
'x-rpc-device_name': 'Xiaomi M2012K11AC',
|
|
|
|
|
'x-rpc-device_model': 'M2012K11AC',
|
|
|
|
|
'x-rpc-app_id': '1953439974',
|
|
|
|
|
'Referer': 'https://app.mihoyo.com',
|
|
|
|
|
'Host': 'api-cloudgame.mihoyo.com',
|
|
|
|
|
'Connection': 'Keep-Alive',
|
|
|
|
|
'Accept-Encoding': 'gzip',
|
|
|
|
|
'User-Agent': 'okhttp/4.9.0'
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-28 09:31:01 +00:00
|
|
|
|
def sign_account(self):
|
|
|
|
|
ret_msg = "云原神:\r\n"
|
|
|
|
|
req = http.get(url=setting.cloud_genshin_Inquire, headers=self.headers)
|
|
|
|
|
data = req.json()
|
|
|
|
|
if data['retcode'] == 0:
|
|
|
|
|
if req["data"]["free_time"]['free_time'] == '0':
|
|
|
|
|
log.info('签到失败,未获得免费时长,可能是已经签到过了或者超出免费时长上线')
|
|
|
|
|
else:
|
|
|
|
|
log.info(f'签到成功,已获得{data["data"]["free_time"]["free_time"]}分钟免费时长')
|
|
|
|
|
ret_msg = f'你当前拥有免费时长 {data["data"]["free_time"]["free_time"]} 分钟,' \
|
|
|
|
|
f'畅玩卡状态为 {data["data"]["play_card"]["short_msg"]},拥有米云币 {data["data"]["coin"]["coin_num"]} 枚'
|
|
|
|
|
log.info(ret_msg)
|
|
|
|
|
elif data['retcode'] == -100:
|
|
|
|
|
ret_msg = "云原神token失效/防沉迷"
|
|
|
|
|
log.warning(ret_msg)
|
|
|
|
|
config.clear_cookie_cloudgame()
|
|
|
|
|
else:
|
|
|
|
|
ret_msg = f'脚本签到失败,json文本:{req.text}'
|
|
|
|
|
log.warning(ret_msg)
|
|
|
|
|
return ret_msg
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
|
pass
|