mirror of
https://github.com/TDSCDMAA/AutoMihoyoBBS.git
synced 2026-06-02 18:43:42 +08:00
修复签到失效
This commit is contained in:
parent
4b6991f498
commit
5299918ed9
@ -1,3 +1,4 @@
|
||||
import json
|
||||
import time
|
||||
import tools
|
||||
import config
|
||||
@ -122,8 +123,11 @@ class Mihoyobbs:
|
||||
log.info("讨论区任务已经完成过了~")
|
||||
else:
|
||||
log.info("正在签到......")
|
||||
header = {}
|
||||
header.update(self.headers)
|
||||
for i in setting.mihoyobbs_List_Use:
|
||||
req = http.post(url=setting.bbs_Sign_url, json={"gids": i["id"]}, headers=self.headers)
|
||||
header["DS"] = tools.get_ds2("", json.dumps({"gids": i["id"]}))
|
||||
req = http.post(url=setting.bbs_Sign_url, json={"gids": i["id"]}, headers=header)
|
||||
data = req.json()
|
||||
if "err" not in data["message"]:
|
||||
log.info(str(i["name"] + data["message"]))
|
||||
@ -159,7 +163,7 @@ class Mihoyobbs:
|
||||
if data["message"] == "OK":
|
||||
log.debug("点赞:{} 成功".format(self.postsList[i][1]))
|
||||
# 判断取消点赞是否打开
|
||||
if config.config["mihoyobbs"]["un_like"] :
|
||||
if config.config["mihoyobbs"]["un_like"]:
|
||||
time.sleep(random.randint(2, 8))
|
||||
req = http.post(url=setting.bbs_Like_url, headers=self.headers,
|
||||
json={"post_id": self.postsList[i][0], "is_cancel": True})
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
# 米游社的Salt
|
||||
mihoyobbs_Salt = "z8DRIUjNDT7IT5IZXvrUAxyupA1peND9"
|
||||
mihoyobbs_Salt2 = "t0qEgfub6cvueAPgR5m9aQWWVciEer7v"
|
||||
mihoyobbs_Salt_web = "9nQiU3AV0rJSIBWgdynfoGMGKaklfbM7"
|
||||
# 米游社的版本
|
||||
mihoyobbs_Version = "2.34.1" # Slat和Version相互对应
|
||||
|
||||
10
tools.py
10
tools.py
@ -36,6 +36,16 @@ def get_ds(web: bool) -> str:
|
||||
return f"{i},{r},{c}"
|
||||
|
||||
|
||||
# 获取请求Header里的DS(版本2) 这个版本ds之前见到都是查询接口里的
|
||||
def get_ds2(q: str, b: str) -> str:
|
||||
n = setting.mihoyobbs_Salt2
|
||||
i = str(timestamp())
|
||||
r = str(random.randint(100001, 200000))
|
||||
add = f'&b={b}&q={q}'
|
||||
c = md5("salt=" + n + "&t=" + i + "&r=" + r + add)
|
||||
return f"{i},{r},{c}"
|
||||
|
||||
|
||||
# 生成一个device id
|
||||
def get_device_id() -> str:
|
||||
return str(uuid.uuid3(uuid.NAMESPACE_URL, config.config["account"]["cookie"]))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user