From b2d3286375c3fcde13e537f2ade464ca99b2351e Mon Sep 17 00:00:00 2001 From: Womsxd <45663319+Womsxd@users.noreply.github.com> Date: Wed, 12 Oct 2022 22:12:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=98=E9=87=8F=E5=B0=8F=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- login.py | 4 ++-- mihoyobbs.py | 14 +++++++------- setting.py | 46 +++++++++++++++++++++++----------------------- 3 files changed, 32 insertions(+), 32 deletions(-) diff --git a/login.py b/login.py index fb1e2f5..d5bba3f 100644 --- a/login.py +++ b/login.py @@ -18,10 +18,10 @@ def login(): config.config["account"]["login_ticket"] = i.split("=")[1] break # 这里获取Stuid,但是实际是可以直接拿cookie里面的Uid - data = http.get(url=setting.bbs_Cookie_url.format(config.config["account"]["login_ticket"])).json() + data = http.get(url=setting.bbs_cookie_url.format(config.config["account"]["login_ticket"])).json() if "成功" in data["data"]["msg"]: config.config["account"]["stuid"] = str(data["data"]["cookie_info"]["account_id"]) - data = http.get(url=setting.bbs_Cookie_url2.format( + data = http.get(url=setting.bbs_cookie_url2.format( config.config["account"]["login_ticket"], config.config["account"]["stuid"])).json() config.config["account"]["stoken"] = data["data"]["list"][0]["token"] log.info("登录成功!") diff --git a/mihoyobbs.py b/mihoyobbs.py index b3a7939..6630fc7 100644 --- a/mihoyobbs.py +++ b/mihoyobbs.py @@ -70,7 +70,7 @@ class Mihoyobbs: global today_have_get_coins global Have_coins log.info("正在获取任务列表") - req = http.get(url=setting.bbs_Tasks_list, headers=self.headers) + req = http.get(url=setting.bbs_tasks_list, headers=self.headers) data = req.json() if "err" in data["message"] or data["retcode"] == -100: log.error("获取任务列表失败,你的cookie可能已过期,请重新设置cookie。") @@ -121,7 +121,7 @@ class Mihoyobbs: def get_list(self) -> list: temp_list = [] log.info("正在获取帖子列表......") - req = http.get(url=setting.bbs_List_url.format(setting.mihoyobbs_List_Use[0]["forumId"]), + req = http.get(url=setting.bbs_post_list_url.format(setting.mihoyobbs_List_Use[0]["forumId"]), headers=self.headers) data = req.json()["data"]["list"] for n in range(5): @@ -150,7 +150,7 @@ class Mihoyobbs: if check_pass: continue header["DS"] = tools.get_ds2("", json.dumps({"gids": i["id"]})) - req = http.post(url=setting.bbs_Sign_url, json={"gids": i["id"]}, headers=header) + req = http.post(url=setting.bbs_sign_url, json={"gids": i["id"]}, headers=header) data = req.json() if data["retcode"] == 1034: log.warning("社区签到触发验证码") @@ -176,7 +176,7 @@ class Mihoyobbs: else: log.info("正在看帖......") for i in range(self.Task_do["bbs_Read_posts_num"]): - req = http.get(url=setting.bbs_Detail_url.format(self.postsList[i][0]), headers=self.headers) + req = http.get(url=setting.bbs_detail_url.format(self.postsList[i][0]), headers=self.headers) data = req.json() if data["message"] == "OK": log.debug("看帖:{} 成功".format(self.postsList[i][1])) @@ -192,7 +192,7 @@ class Mihoyobbs: else: log.info("正在点赞......") for i in range(self.Task_do["bbs_Like_posts_num"]): - req = http.post(url=setting.bbs_Like_url, headers=header, + req = http.post(url=setting.bbs_like_url, headers=header, json={"post_id": self.postsList[i][0], "is_cancel": False}) data = req.json() if data["message"] == "OK": @@ -208,7 +208,7 @@ class Mihoyobbs: # 判断取消点赞是否打开 if config.config["mihoyobbs"]["cancel_like_posts"]: time.sleep(random.randint(2, 8)) - req = http.post(url=setting.bbs_Like_url, headers=self.headers, + req = http.post(url=setting.bbs_like_url, headers=self.headers, json={"post_id": self.postsList[i][0], "is_cancel": True}) data = req.json() if data["message"] == "OK": @@ -223,7 +223,7 @@ class Mihoyobbs: else: log.info("正在执行分享任务......") for i in range(3): - req = http.get(url=setting.bbs_Share_url.format(self.postsList[0][0]), headers=self.headers) + req = http.get(url=setting.bbs_share_url.format(self.postsList[0][0]), headers=self.headers) data = req.json() if data["message"] == "OK": log.debug("分享:{} 成功".format(self.postsList[0][1])) diff --git a/setting.py b/setting.py index 204da1c..8009796 100644 --- a/setting.py +++ b/setting.py @@ -76,45 +76,45 @@ headers = { } # 通用设置 -bbs_Api = "https://bbs-api.mihoyo.com" -web_Api = "https://api-takumi.mihoyo.com" -account_Info_url = web_Api + "/binding/api/getUserGameRolesByCookie?game_biz=" +bbs_api = "https://bbs-api.mihoyo.com" +web_api = "https://api-takumi.mihoyo.com" +account_Info_url = web_api + "/binding/api/getUserGameRolesByCookie?game_biz=" # 米游社的API列表 -bbs_Cookie_url = "https://webapi.account.mihoyo.com/Api/cookie_accountinfo_by_loginticket?login_ticket={}" -bbs_Cookie_url2 = web_Api + "/auth/api/getMultiTokenByLoginTicket?login_ticket={}&token_types=3&uid={}" -bbs_Tasks_list = bbs_Api + "/apihub/sapi/getUserMissionsState" # 获取任务列表 -bbs_Sign_url = bbs_Api + "/apihub/app/api/signIn" # post -bbs_List_url = bbs_Api + "/post/api/getForumPostList?forum_id={}&is_good=false&is_hot=false&page_size=20&sort_type=1" -bbs_Detail_url = bbs_Api + "/post/api/getPostFull?post_id={}" -bbs_Share_url = bbs_Api + "/apihub/api/getShareConf?entity_id={}&entity_type=1" -bbs_Like_url = bbs_Api + "/apihub/sapi/upvotePost" # post json -bbs_get_captcha = bbs_Api + "/misc/api/createVerification?is_high=true" -bbs_captcha_verify = bbs_Api + "/misc/api/verifyVerification" +bbs_cookie_url = "https://webapi.account.mihoyo.com/Api/cookie_accountinfo_by_loginticket?login_ticket={}" +bbs_cookie_url2 = web_api + "/auth/api/getMultiTokenByLoginTicket?login_ticket={}&token_types=3&uid={}" +bbs_tasks_list = bbs_api + "/apihub/sapi/getUserMissionsState" # 获取任务列表 +bbs_sign_url = bbs_api + "/apihub/app/api/signIn" # post +bbs_post_list_url = bbs_api + "/post/api/getForumPostList?forum_id={}&is_good=false&is_hot=false&page_size=20&sort_type=1" +bbs_detail_url = bbs_api + "/post/api/getPostFull?post_id={}" +bbs_share_url = bbs_api + "/apihub/api/getShareConf?entity_id={}&entity_type=1" +bbs_like_url = bbs_api + "/apihub/sapi/upvotePost" # post json +bbs_get_captcha = bbs_api + "/misc/api/createVerification?is_high=true" +bbs_captcha_verify = bbs_api + "/misc/api/verifyVerification" # 崩坏2自动签到相关的相关设置 honkai2_Act_id = "e202203291431091" -honkai2_checkin_rewards = f'{web_Api}/event/luna/home?lang=zh-cn&act_id={honkai2_Act_id}' -honkai2_Is_signurl = web_Api + "/event/luna/info?lang=zh-cn&act_id={}®ion={}&uid={}" -honkai2_Sign_url = web_Api + "/event/luna/sign" +honkai2_checkin_rewards = f'{web_api}/event/luna/home?lang=zh-cn&act_id={honkai2_Act_id}' +honkai2_Is_signurl = web_api + "/event/luna/info?lang=zh-cn&act_id={}®ion={}&uid={}" +honkai2_Sign_url = web_api + "/event/luna/sign" # 崩坏3自动签到相关的设置 honkai3rd_Act_id = "e202207181446311" -honkai3rd_checkin_rewards = f'{web_Api}/event/luna/home?lang=zh-cn&act_id={honkai3rd_Act_id}' -honkai3rd_Is_signurl = web_Api + "/event/luna/info?lang=zh-cn&act_id={}®ion={}&uid={}" -honkai3rd_Sign_url = web_Api + "/event/luna/sign" +honkai3rd_checkin_rewards = f'{web_api}/event/luna/home?lang=zh-cn&act_id={honkai3rd_Act_id}' +honkai3rd_Is_signurl = web_api + "/event/luna/info?lang=zh-cn&act_id={}®ion={}&uid={}" +honkai3rd_Sign_url = web_api + "/event/luna/sign" # 未定事件簿自动签到相关设置 tearsofthemis_Act_id = "e202202251749321" -tearsofthemis_checkin_rewards = f'{web_Api}/event/luna/home?lang=zh-cn&act_id={tearsofthemis_Act_id}' +tearsofthemis_checkin_rewards = f'{web_api}/event/luna/home?lang=zh-cn&act_id={tearsofthemis_Act_id}' tearsofthemis_Is_signurl = honkai2_Is_signurl tearsofthemis_Sign_url = honkai2_Sign_url # 和二崩完全一致 # 原神自动签到相关的设置 genshin_Act_id = "e202009291139501" -genshin_checkin_rewards = f'{web_Api}/event/bbs_sign_reward/home?act_id={genshin_Act_id}' -genshin_Is_signurl = web_Api + "/event/bbs_sign_reward/info?act_id={}®ion={}&uid={}" -genshin_Signurl = web_Api + "/event/bbs_sign_reward/sign" +genshin_checkin_rewards = f'{web_api}/event/bbs_sign_reward/home?act_id={genshin_Act_id}' +genshin_Is_signurl = web_api + "/event/bbs_sign_reward/info?act_id={}®ion={}&uid={}" +genshin_Signurl = web_api + "/event/bbs_sign_reward/sign" # 云原神相关api cloud_genshin_Api = "https://api-cloudgame.mihoyo.com"