mirror of
https://github.com/TDSCDMAA/AutoMihoyoBBS.git
synced 2026-06-02 18:43:42 +08:00
pre
This commit is contained in:
parent
386469da13
commit
287892669f
21
README.md
21
README.md
@ -1,6 +1,6 @@
|
||||
# 米游社云签到
|
||||
# 米游社自动签到
|
||||
|
||||
基于Python3的米游社云签到项目
|
||||
基于Python3的米游社自动签到项目
|
||||
|
||||
本项目参考[XiaoMiku01/miyoubiAuto](https://github.com/XiaoMiku01/miyoubiAuto)进行编写
|
||||
|
||||
@ -22,24 +22,25 @@
|
||||
|
||||
5. 打开目录中的**config文件夹**复制`config.json.example`并改名为`config.json`,如果需要使用多用户的功能的话请改名成`xxx.json`
|
||||
|
||||
6. 请使用vscode/notepad++等文本编辑器打开`config.json`
|
||||
6. 请使用vscode/notepad++等文本编辑器打开上一步复制好的配置文件
|
||||
|
||||
7. **使用[获取Cookie](#获取米游社Cookie)里面的方法来获取米游社Cookie**
|
||||
|
||||
8. 将复制的Cookie粘贴到`config.json`的`"mihoyobbs_Cookies":" "`中
|
||||
|
||||
#### 列子
|
||||
例子
|
||||
|
||||
> ```json
|
||||
> "mihoyobbs_Cookies": "你复制的cookie"
|
||||
> ```
|
||||
|
||||
> ```json
|
||||
> "mihoyobbs_Cookies": "你复制的cookie"
|
||||
> ```
|
||||
|
||||
9. 在命令提示符(cmd)/powershell,输入`python main.py`来进行执行
|
||||
|
||||
10. 多用户的请使用`python main_multi.py`,多用户在需要自动执行的情况下请使用`python main_multi.py autorun`
|
||||
|
||||
## 获取米游社Cookie
|
||||
|
||||
1. 打开你的浏览器,进入无痕/隐身模式
|
||||
1. 打开你的浏览器,进入**无痕/隐身模式**
|
||||
|
||||
2. 打开`http://bbs.mihoyo.com/ys/`并进行登入操作
|
||||
|
||||
@ -57,4 +58,4 @@
|
||||
|
||||
## License
|
||||
|
||||
[MIT License](https://github.com/Womsxd/AutoMihoyoBBS/blob/master/LICENSE)
|
||||
[MIT License](https://github.com/Womsxd/AutoMihoyoBBS/blob/master/LICENSE)
|
||||
|
||||
35
mihoyobbs.py
35
mihoyobbs.py
@ -23,6 +23,24 @@ class mihoyobbs:
|
||||
}
|
||||
self.postsList = self.Getlist()
|
||||
|
||||
#获取任务列表,用来判断还有哪些漏做了
|
||||
def Get_taskslist(self):
|
||||
temp_List = []
|
||||
#ToDo
|
||||
|
||||
#获取要帖子列表
|
||||
def Getlist(self) -> list:
|
||||
temp_List = []
|
||||
tools.log.info("正在获取帖子列表......")
|
||||
for i in setting.mihoyobbs_List_Use:
|
||||
req = httpx.get(url=setting.bbs_Listurl.format(i["forumId"]), headers=self.headers)
|
||||
data = req.json()
|
||||
for n in range(6):
|
||||
temp_List.append([data["data"]["list"][n]["post"]["post_id"], data["data"]["list"][n]["post"]["subject"]])
|
||||
tools.log.info("已获取{}个帖子".format(len(temp_List)))
|
||||
time.sleep(random.randint(2, 6))
|
||||
return (temp_List)
|
||||
|
||||
#进行签到操作
|
||||
def Singin(self):
|
||||
tools.log.info("正在签到......")
|
||||
@ -37,19 +55,6 @@ class mihoyobbs:
|
||||
config.Clear_cookies()
|
||||
exit()
|
||||
|
||||
#获取要帖子列表
|
||||
def Getlist(self) -> list:
|
||||
temp_List = []
|
||||
tools.log.info("正在获取帖子列表......")
|
||||
for i in setting.mihoyobbs_List_Use:
|
||||
req = httpx.get(url=setting.bbs_Listurl.format(i["forumId"]), headers=self.headers)
|
||||
data = req.json()
|
||||
for n in range(5):
|
||||
temp_List.append([data["data"]["list"][n]["post"]["post_id"], data["data"]["list"][n]["post"]["subject"]])
|
||||
tools.log.info("已获取{}个帖子".format(len(temp_List)))
|
||||
time.sleep(random.randint(2, 6))
|
||||
return (temp_List)
|
||||
|
||||
#看帖子
|
||||
def Readposts(self):
|
||||
tools.log.info("正在看帖......")
|
||||
@ -82,8 +87,8 @@ class mihoyobbs:
|
||||
#分享操作
|
||||
def Share(self):
|
||||
tools.log.info("正在分享......")
|
||||
req = httpx.get(url=setting.bbs_Shareurl.format(self.postsList[0][0]), headers=self.headers)
|
||||
req = httpx.get(url=setting.bbs_Shareurl.format(random.choice(self.postsList)[0]), headers=self.headers)
|
||||
data = req.json()
|
||||
if data["message"] == "OK":
|
||||
tools.log.info("分享:{} 成功".format(self.postsList[0][1]))
|
||||
tools.log.info("分享:{} 成功".format(random.choice(self.postsList)[1]))
|
||||
time.sleep(random.randint(2, 6))
|
||||
@ -42,6 +42,7 @@ mihoyobbs_List_Use= []
|
||||
#米游社的API列表
|
||||
bbs_Cookieurl = "https://webapi.account.mihoyo.com/Api/cookie_accountinfo_by_loginticket?login_ticket={}"
|
||||
bbs_Cookieurl2 = "https://api-takumi.mihoyo.com/auth/api/getMultiTokenByLoginTicket?login_ticket={}&token_types=3&uid={}"
|
||||
bbs_Taskslist = "https://bbs-api.mihoyo.com/apihub/sapi/getUserMissionsState"
|
||||
bbs_Signurl = "https://bbs-api.mihoyo.com/apihub/sapi/signIn?gids={}" # post
|
||||
bbs_Listurl = "https://bbs-api.mihoyo.com/post/api/getForumPostList?forum_id={}&is_good=false&is_hot=false&page_size=20&sort_type=1"
|
||||
bbs_Detailurl = "https://bbs-api.mihoyo.com/post/api/getPostFull?post_id={}"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user