This commit is contained in:
Qiuyelin 2022-09-06 15:05:57 +08:00
parent 5a6a8dbd35
commit b217939063
3 changed files with 20 additions and 7 deletions

View File

@ -24,12 +24,18 @@
### 说明 ### 说明
1. 首先,<a href="javascript:(function(){data=JSON.parse(localStorage.user);prompt('',JSON.stringify({token:data['token'],userId:data['userId'], tenantCode:data['tenantCode'], userProjectId: data['preUserProjectId']}));})();">请将这个链接拖入收藏夹</a> 1. 登录[安全微伴 (mycourse.cn)](http://weiban.mycourse.cn/#/login),在登录后的页面上运行刚才添加进收藏夹的脚本
2. 登录[安全微伴 (mycourse.cn)](http://weiban.mycourse.cn/#/login),在登录后的页面上运行刚才添加进收藏夹的脚本 2. 在浏览器地址栏运行
```
javascript:(function(){data=JSON.parse(localStorage.user);prompt('',JSON.stringify({token:data['token'],userId:data['userId'], tenantCode:data['tenantCode'], userProjectId: data['preUserProjectId']}));})();
```
浏览器地址栏如果吞掉了“`javascript:`”,请手动加上,或者你可以将上述脚本添加到收藏夹。
3. 复制弹窗内的内容,**按照格式**添加到`config.json`。(格式不对会报错) 3. 复制弹窗内的内容,**按照格式**添加到`config.json`。(格式不对会报错)
[![1662441411827.png](http://png.eot.ooo/i/2022/09/06/6316d7c7f3567.png)](http://png.eot.ooo/i/2022/09/06/6316d7c7f3567.png) [![1662441411827.png](http://png.eot.ooo/i/2022/09/06/6316d7c7f3567.png)](http://png.eot.ooo/i/2022/09/06/6316d7c7f3567.png)
4. 运行`main.exe`。 4. 运行`main.py` 或者 [main.exe](https://github.com/pooneyy/weiban-tool/releases)

View File

@ -2,7 +2,6 @@ import time
import requests import requests
import json import json
class main: class main:
tenantCode = 0 tenantCode = 0
userId = "" userId = ""

12
main.py
View File

@ -1,6 +1,7 @@
# @Author : Qiuyelin # @Author : Qiuyelin
# @repo : https://github.com/pooneyy/weiban-tool # @repo : https://github.com/pooneyy/weiban-tool
import os
import Utils import Utils
import time import time
import json import json
@ -16,9 +17,16 @@ try:
userProjectId = user['userProjectId'] userProjectId = user['userProjectId']
main = Utils.main(tenantCode, userId, x_token, userProjectId) main = Utils.main(tenantCode, userId, x_token, userProjectId)
main.init() main.init()
finishIdList = main.getFinishIdList() try:
finishIdList = main.getFinishIdList()
except json.decoder.JSONDecodeError:
print('账户信息错误或已经过期请重新获取。详见https://github.com/pooneyy/weiban-tool')
break
for i in main.getCourse(): for i in main.getCourse():
main.start(i) main.start(i)
time.sleep(20) time.sleep(20)
main.finish(finishIdList[i]) main.finish(finishIdList[i])
except FileNotFoundError:print('未找到 config.json !') os.system("pause")
except FileNotFoundError:
print('未找到 config.json详见https://github.com/pooneyy/weiban-tool')
os.system("pause")