mirror of
https://github.com/TDSCDMAA/AutoMihoyoBBS.git
synced 2026-06-02 18:43:42 +08:00
云原神签到
This commit is contained in:
parent
f4b2433fd9
commit
858d425d15
@ -1,18 +1,17 @@
|
|||||||
import setting
|
|
||||||
from request import http
|
|
||||||
import tools
|
import tools
|
||||||
import config
|
import config
|
||||||
|
import setting
|
||||||
|
from request import http
|
||||||
from loghelper import log
|
from loghelper import log
|
||||||
|
|
||||||
|
|
||||||
|
class CloudGenshin:
|
||||||
class cloud_ys():
|
def __init__(self) -> None:
|
||||||
def __init__(self,token) -> None:
|
|
||||||
self.headers = {
|
self.headers = {
|
||||||
'x-rpc-combo_token': token,
|
'x-rpc-combo_token': config.config['cloud_games']['genshin']['token'],
|
||||||
'x-rpc-client_type': setting.mihoyobbs_Client_type,
|
'x-rpc-client_type': setting.mihoyobbs_Client_type,
|
||||||
'x-rpc-app_version': setting.cloudgenshin_Version,
|
'x-rpc-app_version': setting.cloudgenshin_Version,
|
||||||
'x-rpc-sys_version': '12', # Previous version need to convert the type of this var
|
'x-rpc-sys_version': '12',
|
||||||
'x-rpc-channel': 'mihoyo',
|
'x-rpc-channel': 'mihoyo',
|
||||||
'x-rpc-device_id': tools.get_device_id(),
|
'x-rpc-device_id': tools.get_device_id(),
|
||||||
'x-rpc-device_name': 'Xiaomi M2012K11AC',
|
'x-rpc-device_name': 'Xiaomi M2012K11AC',
|
||||||
@ -25,20 +24,27 @@ class cloud_ys():
|
|||||||
'User-Agent': 'okhttp/4.9.0'
|
'User-Agent': 'okhttp/4.9.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
def Sgin(self):
|
def sign_account(self):
|
||||||
req = http.get(url=setting.Cloud_Ys_Sgin,headers=self.headers).json()
|
ret_msg = "云原神:\r\n"
|
||||||
try:
|
req = http.get(url=setting.cloud_genshin_Inquire, headers=self.headers)
|
||||||
jg = req['data']['list'][0]['msg']
|
data = req.json()
|
||||||
if "每日登录奖励" in jg:
|
if data['retcode'] == 0:
|
||||||
log.info("云原神签到成功")
|
if req["data"]["free_time"]['free_time'] == '0':
|
||||||
data = "云原神签到成功"
|
log.info('签到失败,未获得免费时长,可能是已经签到过了或者超出免费时长上线')
|
||||||
except IndexError:
|
else:
|
||||||
log.warning("云原神签到失败或重复签到")
|
log.info(f'签到成功,已获得{data["data"]["free_time"]["free_time"]}分钟免费时长')
|
||||||
data = "云原神签到失败或重复签到"
|
ret_msg = f'你当前拥有免费时长 {data["data"]["free_time"]["free_time"]} 分钟,' \
|
||||||
except Exception as er:
|
f'畅玩卡状态为 {data["data"]["play_card"]["short_msg"]},拥有米云币 {data["data"]["coin"]["coin_num"]} 枚'
|
||||||
log.warning(f"云原神签到失败,出现了错误:{er}")
|
log.info(ret_msg)
|
||||||
data = f"云原神签到失败,出现了错误:{er}"
|
elif data['retcode'] == -100:
|
||||||
reqs = http.get(url=setting.Cloud_ys_Inquire,headers=self.headers).json()
|
ret_msg = "云原神token失效/防沉迷"
|
||||||
nr = (f"\n你当前拥有免费时长 {reqs['data']['free_time']['free_time']} 分钟,畅玩卡状态为 {reqs['data']['play_card']['short_msg']},拥有米云币 {reqs['data']['coin']['coin_num']} 枚")
|
log.warning(ret_msg)
|
||||||
data = data + nr
|
config.clear_cookie_cloudgame()
|
||||||
return data
|
else:
|
||||||
|
ret_msg = f'脚本签到失败,json文本:{req.text}'
|
||||||
|
log.warning(ret_msg)
|
||||||
|
return ret_msg
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
pass
|
||||||
|
|||||||
10
main.py
10
main.py
@ -96,14 +96,14 @@ def main():
|
|||||||
ret_code = 3
|
ret_code = 3
|
||||||
return_data += "\n\n" + genshin_message
|
return_data += "\n\n" + genshin_message
|
||||||
time.sleep(random.randint(2, 8))
|
time.sleep(random.randint(2, 8))
|
||||||
if config.config['cloud_genshin']['enable']:
|
if config.config['cloud_games']['genshin']["enable"]:
|
||||||
log.info("正在进行云原神签到")
|
log.info("正在进行云原神签到")
|
||||||
if config.config['cloud_genshin']['token'] == "":
|
if config.config['cloud_games']['genshin']['token'] == "":
|
||||||
log.info("token为空,跳过任务")
|
log.info("token为空,跳过任务")
|
||||||
else:
|
else:
|
||||||
cloud_ys = cloud_genshin.cloud_ys(config.config['cloud_genshin']['token'])
|
cloud_ys = cloud_genshin.CloudGenshin()
|
||||||
data = cloud_ys.Sgin()
|
data = cloud_ys.sign_account()
|
||||||
return_data += "\n\n云原神:\n"+data
|
return_data += "\n\n" + data
|
||||||
return ret_code, return_data
|
return ret_code, return_data
|
||||||
elif config.config["account"]["cookie"] == "CookieError":
|
elif config.config["account"]["cookie"] == "CookieError":
|
||||||
raise CookieError('Cookie expires')
|
raise CookieError('Cookie expires')
|
||||||
|
|||||||
@ -7,7 +7,7 @@ mihoyobbs_Version = "2.35.2" # Slat和Version相互对应
|
|||||||
# 米游社的客户端类型
|
# 米游社的客户端类型
|
||||||
mihoyobbs_Client_type = "2" # 1为ios 2为安卓
|
mihoyobbs_Client_type = "2" # 1为ios 2为安卓
|
||||||
mihoyobbs_Client_type_web = "5" # 4为pc web 5为mobile web
|
mihoyobbs_Client_type_web = "5" # 4为pc web 5为mobile web
|
||||||
#云原神版本
|
# 云原神版本
|
||||||
cloudgenshin_Version = "3.0.0"
|
cloudgenshin_Version = "3.0.0"
|
||||||
|
|
||||||
# 米游社的分区列表
|
# 米游社的分区列表
|
||||||
@ -78,7 +78,6 @@ headers = {
|
|||||||
# 通用设置
|
# 通用设置
|
||||||
bbs_Api = "https://bbs-api.mihoyo.com"
|
bbs_Api = "https://bbs-api.mihoyo.com"
|
||||||
web_Api = "https://api-takumi.mihoyo.com"
|
web_Api = "https://api-takumi.mihoyo.com"
|
||||||
Cloud_Ys_Api = "https://api-cloudgame.mihoyo.com"
|
|
||||||
account_Info_url = web_Api + "/binding/api/getUserGameRolesByCookie?game_biz="
|
account_Info_url = web_Api + "/binding/api/getUserGameRolesByCookie?game_biz="
|
||||||
|
|
||||||
# 米游社的API列表
|
# 米游社的API列表
|
||||||
@ -116,5 +115,5 @@ genshin_Is_signurl = web_Api + "/event/bbs_sign_reward/info?act_id={}®ion={}&
|
|||||||
genshin_Signurl = web_Api + "/event/bbs_sign_reward/sign"
|
genshin_Signurl = web_Api + "/event/bbs_sign_reward/sign"
|
||||||
|
|
||||||
# 云原神相关api
|
# 云原神相关api
|
||||||
Cloud_Ys_Sgin = Cloud_Ys_Api + "/hk4e_cg_cn/gamer/api/listNotifications?status=NotificationStatusUnread&type=NotificationTypePopup&is_sort=true"
|
cloud_genshin_Api = "https://api-cloudgame.mihoyo.com"
|
||||||
Cloud_ys_Inquire = Cloud_Ys_Api + "/hk4e_cg_cn/wallet/wallet/get"
|
cloud_genshin_Inquire = cloud_genshin_Api + "/hk4e_cg_cn/wallet/wallet/get"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user