sing->Sign

This commit is contained in:
Womsxd 2021-08-03 10:35:55 +08:00
parent aaaade2be2
commit b08728a229
No known key found for this signature in database
GPG Key ID: 0FE76418EE689B68
8 changed files with 61 additions and 61 deletions

View File

@ -15,14 +15,14 @@ mihoyobbs = {
#全局开关,关闭之后下面的都不执行
"bbs_Global": True,
#讨论区签到
"bbs_Singin": True,
"bbs_Signin": True,
#多个讨论区签到
"bbs_Singin_multi": True,
"bbs_Signin_multi": True,
#指定签到讨论区
#1是崩坏3 2是原神 3是崩坏2 4是未定事件簿 5是大别墅
#可以通过设置讨论区的id位置来设置主讨论区[5,1]就是大别墅为主社区
#看帖子 点赞 分享帖子都是使用主社区获取到的列表
"bbs_Singin_multi_list": [2,5],
"bbs_Signin_multi_list": [2,5],
#浏览3个帖子
"bbs_Read_posts": True,
#完成5次点赞
@ -33,9 +33,9 @@ mihoyobbs = {
"bbs_Share": True,
}
#原神自动签到
genshin_Auto_sing = True
genshin_Auto_sign = True
#崩坏3自动签到
honkai3rd_Auto_sing = True
honkai3rd_Auto_sign = True
path = os.path.dirname(os.path.realpath(__file__)) + "/config"
config_Path = f"{path}/config.json"
@ -49,23 +49,23 @@ def Load_config():
global mihoyobbs_Stoken
global mihoyobbs_Cookies
global mihoyobbs
global genshin_Auto_sing
global honkai3rd_Auto_sing
global genshin_Auto_sign
global honkai3rd_Auto_sign
enable_Config = data["enable_Config"]
mihoyobbs_Login_ticket = data["mihoyobbs_Login_ticket"]
mihoyobbs_Stuid = data["mihoyobbs_Stuid"]
mihoyobbs_Stoken = data["mihoyobbs_Stoken"]
mihoyobbs_Cookies = data["mihoyobbs_Cookies"]
mihoyobbs["bbs_Gobal"] = data["mihoyobbs"]["bbs_Global"]
mihoyobbs["bbs_Singin"] = data["mihoyobbs"]["bbs_Singin"]
mihoyobbs["bbs_Singin_multi"] = data["mihoyobbs"]["bbs_Singin_multi"]
mihoyobbs["bbs_Singin_multi_list"] = data["mihoyobbs"]["bbs_Singin_multi_list"]
mihoyobbs["bbs_Signin"] = data["mihoyobbs"]["bbs_Signin"]
mihoyobbs["bbs_Signin_multi"] = data["mihoyobbs"]["bbs_Signin_multi"]
mihoyobbs["bbs_Signin_multi_list"] = data["mihoyobbs"]["bbs_Signin_multi_list"]
mihoyobbs["bbs_Read_posts"] = data["mihoyobbs"]["bbs_Read_posts"]
mihoyobbs["bbs_Like_posts"] = data["mihoyobbs"]["bbs_Like_posts"]
mihoyobbs["bbs_Unlike"] = data["mihoyobbs"]["bbs_Unlike"]
mihoyobbs["bbs_Share"] = data["mihoyobbs"]["bbs_Share"]
genshin_Auto_sing = data["genshin_Auto_sing"]
honkai3rd_Auto_sing = data["honkai3rd_Auto_sing"]
genshin_Auto_sign = data["genshin_Auto_sign"]
honkai3rd_Auto_sign = data["honkai3rd_Auto_sign"]
f.close()
tools.log.info("Config加载完毕")

View File

@ -45,9 +45,9 @@
```json
"mihoyobbs": {
"bbs_Global": true,
"bbs_Singin": true,
"bbs_Singin_multi": true,
"bbs_Singin_multi_list": [2, 5],
"bbs_Signin": true,
"bbs_Signin_multi": true,
"bbs_Signin_multi_list": [2, 5],
"bbs_Read_posts": true,
"bbs_Like_posts": true,
"bbs_Unlike": true,
@ -59,11 +59,11 @@
>`bbs_Global`的作用是是否启用米游币获取,`bool`类型,可设置`true`(默认)和`false`
>
>`bbs_Singin`的作用是是否启用讨论区自动签到,`bool`类型,可设置`true`(默认)和`false`
>`bbs_Signin`的作用是是否启用讨论区自动签到,`bool`类型,可设置`true`(默认)和`false`
>
>`bbs_Singin_multi`的作用是是否启用多个讨论区签到(关闭的话只签到大别墅)`bool`类型,可设置`true`(默认)和`false`
>`bbs_Signin_multi`的作用是是否启用多个讨论区签到(关闭的话只签到大别墅)`bool`类型,可设置`true`(默认)和`false`
>
>`bbs_Singin_multi_list`的作用设置要签到的讨论区,`array`类型(**python**里面是`list`),可设置内容可以设置`[1,2,3,4,5]`签到全部讨论区,默认是`[2,5]`可以通过调整id的位置来进行设置阅读/点赞/分享指定讨论区的帖子`[2,1,5]`签到原神崩坏3和大别墅[讨论区的id对应关系](## 讨论区的id对应关系)
>`bbs_Signin_multi_list`的作用设置要签到的讨论区,`array`类型(**python**里面是`list`),可设置内容可以设置`[1,2,3,4,5]`签到全部讨论区,默认是`[2,5]`可以通过调整id的位置来进行设置阅读/点赞/分享指定讨论区的帖子`[2,1,5]`签到原神崩坏3和大别墅[讨论区的id对应关系](## 讨论区的id对应关系)
>
>`bbs_Read_posts`的作用是是否启用自动阅读帖子,`bool`类型,可设置`true`(默认)和`false`
>
@ -74,13 +74,13 @@
>`bbs_Share`的作用是是否启用自动分享帖子,`bool`类型,可设置`true`(默认)和`false`
```json
"genshin_Auto_sing": true,
"genshin_Auto_sign": true,
```
>此字段的作用是是否启用原神自动签到,`bool`类型,可设置`true`(默认)和`false`
```json
"honkai3rd_Auto_sing": false
"honkai3rd_Auto_sign": false
```
>此字段的作用是是否启用崩坏3自动签到`bool`类型,可设置`true`和`false`(默认)

View File

@ -7,14 +7,14 @@
"mihoyobbs_Cookies": "",
"mihoyobbs": {
"bbs_Global": true,
"bbs_Singin": true,
"bbs_Singin_multi": true,
"bbs_Singin_multi_list": [2, 5],
"bbs_Signin": true,
"bbs_Signin_multi": true,
"bbs_Signin_multi_list": [2, 5],
"bbs_Read_posts": true,
"bbs_Like_posts": true,
"bbs_Unlike": true,
"bbs_Share": true
},
"genshin_Auto_sing": true,
"honkai3rd_Auto_sing": false
"genshin_Auto_sign": true,
"honkai3rd_Auto_sign": false
}

View File

@ -23,7 +23,7 @@ class genshin:
}
self.acc_List = self.Getacc_list()
if len(self.acc_List) != 0:
self.sing_Give = self.Get_singgive()
self.sign_Give = self.Get_signgive()
#获取绑定的账号列表
def Getacc_list(self) -> list:
@ -40,9 +40,9 @@ class genshin:
return temp_List
#获取已经签到奖励列表
def Get_singgive(self) -> list:
def Get_signgive(self) -> list:
tools.log.info("正在获取签到奖励列表...")
req = http.get(setting.genshin_Singlisturl.format(setting.genshin_Act_id),headers=self.headers)
req = http.get(setting.genshin_Signlisturl.format(setting.genshin_Act_id),headers=self.headers)
data = req.json()
if data["retcode"] != 0:
tools.log.warn("获取签到奖励列表失败")
@ -51,8 +51,8 @@ class genshin:
return data["data"]["awards"]
#判断签到
def Is_sing(self, region:str, uid:str):
req = http.get(setting.genshin_Is_singurl.format(setting.genshin_Act_id, region, uid), headers=self.headers)
def Is_sign(self, region:str, uid:str):
req = http.get(setting.genshin_Is_signurl.format(setting.genshin_Act_id, region, uid), headers=self.headers)
data = req.json()
if data["retcode"] != 0:
tools.log.warn("获取账号签到信息失败!")
@ -61,30 +61,30 @@ class genshin:
return data["data"]
#签到
def Sing_acc(self):
def Sign_acc(self):
if len(self.acc_List) != 0:
for i in self.acc_List:
tools.log.info(f"正在为旅行者{i[0]}进行签到...")
time.sleep(random.randint(2, 6))
is_data = self.Is_sing(region = i[2], uid = i[1])
is_data = self.Is_sign(region = i[2], uid = i[1])
if is_data["first_bind"] == True:
tools.log.warn(f"旅行者{i[0]}是第一次绑定米游社,请先手动签到一次")
else:
sing_Days = is_data["total_sign_day"] - 1
sign_Days = is_data["total_sign_day"] - 1
if is_data["is_sign"] == True:
tools.log.info(f"旅行者{i[0]}今天已经签到过了~\r\n今天获得的奖励是{tools.Get_item(self.sing_Give[sing_Days])}")
tools.log.info(f"旅行者{i[0]}今天已经签到过了~\r\n今天获得的奖励是{tools.Get_item(self.sign_Give[sign_Days])}")
else:
time.sleep(random.randint(2, 6))
req = http.post(url=setting.genshin_Singurl, headers=self.headers,
req = http.post(url=setting.genshin_Signurl, headers=self.headers,
json={'act_id': setting.genshin_Act_id, 'region': i[2], 'uid': i[1]})
data = req.json()
if data["retcode"] == 0:
if sing_Days == 0:
tools.log.info(f"旅行者{i[0]}签到成功~\r\n今天获得的奖励是{tools.Get_item(self.sing_Give[sing_Days])}")
if sign_Days == 0:
tools.log.info(f"旅行者{i[0]}签到成功~\r\n今天获得的奖励是{tools.Get_item(self.sign_Give[sign_Days])}")
else:
tools.log.info(f"旅行者{i[0]}签到成功~\r\n今天获得的奖励是{tools.Get_item(self.sing_Give[sing_Days + 1])}")
tools.log.info(f"旅行者{i[0]}签到成功~\r\n今天获得的奖励是{tools.Get_item(self.sign_Give[sign_Days + 1])}")
elif data["retcode"] == -5003:
tools.log.info(f"旅行者{i[0]}今天已经签到过了~\r\n今天获得的奖励是{tools.Get_item(self.sing_Give[sing_Days])}")
tools.log.info(f"旅行者{i[0]}今天已经签到过了~\r\n今天获得的奖励是{tools.Get_item(self.sign_Give[sign_Days])}")
else:
tools.log.warn("账号签到失败!")
print (req.text)

View File

@ -49,8 +49,8 @@ class honkai3rd:
return raw_data[i]
#判断签到
def Is_sing(self, region:str, uid:str, nickname:str):
req = http.get(setting.honkai3rd_Is_singurl.format(setting.honkai3rd_Act_id, region, uid), headers=self.headers)
def Is_sign(self, region:str, uid:str, nickname:str):
req = http.get(setting.honkai3rd_Is_signurl.format(setting.honkai3rd_Act_id, region, uid), headers=self.headers)
data = req.json()
if data["retcode"] != 0:
tools.log.warn("获取账号签到信息失败!")
@ -64,15 +64,15 @@ class honkai3rd:
return False
#签到
def Sing_acc(self):
def Sign_acc(self):
if len(self.acc_List) != 0:
for i in self.acc_List:
tools.log.info(f"正在为舰长{i[0]}进行签到...")
time.sleep(random.randint(2, 6))
is_data = self.Is_sing(region = i[2], uid = i[1], nickname = i[0])
is_data = self.Is_sign(region = i[2], uid = i[1], nickname = i[0])
if is_data == True:
time.sleep(random.randint(2, 6))
req = http.post(url=setting.honkai3rd_SingUrl, headers=self.headers,
req = http.post(url=setting.honkai3rd_SignUrl, headers=self.headers,
json={'act_id': setting.honkai3rd_Act_id, 'region': i[2], 'uid': i[1]})
data = req.json()
if data["retcode"] == 0:

22
main.py
View File

@ -17,29 +17,29 @@ def main():
#登入
login.login()
time.sleep(random.randint(2,6))
#获取要使用的BBS列表,#判断是否开启bbs_Singin_multi
if config.mihoyobbs["bbs_Singin_multi"] == True:
#获取要使用的BBS列表,#判断是否开启bbs_Signin_multi
if config.mihoyobbs["bbs_Signin_multi"] == True:
#速度快,但是无法设置主社区,主社区默认为第一个
'''
for i in setting.mihoyobbs_List:
if int(i["id"]) in config.mihoyobbs["bbs_Singin_multi_list"]:
if int(i["id"]) in config.mihoyobbs["bbs_Signin_multi_list"]:
setting.mihoyobbs_List_Use.append(i)
'''
#用这里的方案可以实现当让id在第一个的时候为主社区
for i in config.mihoyobbs["bbs_Singin_multi_list"]:
for i in config.mihoyobbs["bbs_Signin_multi_list"]:
for i2 in setting.mihoyobbs_List:
if i == int(i2["id"]):
setting.mihoyobbs_List_Use.append(i2)
else:
#关闭bbs_Singin_multi后只签到大别墅
#关闭bbs_Signin_multi后只签到大别墅
for i in setting.mihoyobbs_List:
if int(i["id"]) == 5:
setting.mihoyobbs_List_Use.append(i)
#米游社签到
if config.mihoyobbs["bbs_Global"] == True:
bbs = mihoyobbs.mihoyobbs()
if config.mihoyobbs["bbs_Singin"] == True:
bbs.Singin()
if config.mihoyobbs["bbs_Signin"] == True:
bbs.Signin()
if config.mihoyobbs["bbs_Read_posts"] == True:
bbs.Readposts()
if config.mihoyobbs["bbs_Like_posts"] == True:
@ -52,18 +52,18 @@ def main():
else:
tools.log.info("米游社功能未启用!")
#原神签到
if(config.genshin_Auto_sing == True):
if(config.genshin_Auto_sign == True):
tools.log.info("正在进行原神签到")
genshin_Help = genshin.genshin()
genshin_Help.Sing_acc()
genshin_Help.Sign_acc()
time.sleep(random.randint(2,6))
else:
tools.log.info("原神签到功能未启用!")
#崩坏3签到
if config.honkai3rd_Auto_sing == True:
if config.honkai3rd_Auto_sign == True:
tools.log.info("正在进行崩坏3签到")
honkai3rd_Help = honkai3rd.honkai3rd()
honkai3rd_Help.Sing_acc()
honkai3rd_Help.Sign_acc()
else:
tools.log.info("崩坏3签到功能未启用")
else:

View File

@ -101,7 +101,7 @@ class mihoyobbs:
return temp_List
#进行签到操作
def Singin(self):
def Signin(self):
#签到这里暂时不设置判断,防止要签到的其他社区没有签到成功
#if self.Task_do["bbs_Sign"] == False:
tools.log.info("正在签到......")

View File

@ -52,12 +52,12 @@ bbs_Likeurl = "https://bbs-api.mihoyo.com/apihub/sapi/upvotePost" # post json
#原神自动签到相关的设置
genshin_Act_id = "e202009291139501"
genshin_Account_info_url = "https://api-takumi.mihoyo.com/binding/api/getUserGameRolesByCookie?game_biz=hk4e_cn"
genshin_Singlisturl = "https://api-takumi.mihoyo.com/event/bbs_sign_reward/home?act_id={}"
genshin_Is_singurl = "https://api-takumi.mihoyo.com/event/bbs_sign_reward/info?act_id={}&region={}&uid={}"
genshin_Singurl = "https://api-takumi.mihoyo.com/event/bbs_sign_reward/sign"
genshin_Signlisturl = "https://api-takumi.mihoyo.com/event/bbs_sign_reward/home?act_id={}"
genshin_Is_signurl = "https://api-takumi.mihoyo.com/event/bbs_sign_reward/info?act_id={}&region={}&uid={}"
genshin_Signurl = "https://api-takumi.mihoyo.com/event/bbs_sign_reward/sign"
#崩坏3自动签到相关的设置
honkai3rd_Act_id = "e202104072769"
honkai3rd_Account_info_url = "https://api-takumi.mihoyo.com/binding/api/getUserGameRolesByCookie?game_biz=bh3_cn"
honkai3rd_Is_singurl = "https://api-takumi.mihoyo.com/common/euthenia/index?act_id={}&region={}&uid={}"
honkai3rd_SingUrl = "https://api-takumi.mihoyo.com/common/euthenia/sign"
honkai3rd_Is_signurl = "https://api-takumi.mihoyo.com/common/euthenia/index?act_id={}&region={}&uid={}"
honkai3rd_SignUrl = "https://api-takumi.mihoyo.com/common/euthenia/sign"