Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
pooneyy committed Sep 6, 2022
1 parent 5a6a8db commit b217939
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`。(格式不对会报错)
[![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)
1 change: 0 additions & 1 deletion Utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import requests
import json


class main:
tenantCode = 0
userId = ""
Expand Down
12 changes: 10 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# @Author : Qiuyelin
# @repo : https://github.com/pooneyy/weiban-tool

import os
import Utils
import time
import json
Expand All @@ -16,9 +17,16 @@
userProjectId = user['userProjectId']
main = Utils.main(tenantCode, userId, x_token, userProjectId)
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():
main.start(i)
time.sleep(20)
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")

0 comments on commit b217939

Please sign in to comment.