Skip to content

Commit 4b2d6d5

Browse files
authored
修复 process_course 中无法使用 cookie 的问题 (#34)
1 parent ea0fafc commit 4b2d6d5

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
__pycache__
22
venv/
3-
.pass
3+
.pass
4+
example_cookie.txt

learn_async.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,12 @@ def clear(args):
649649
def process_course(c, args):
650650
# 处理单个课程的函数,用于多进程
651651
build_global(args)
652-
login(args.username, args.password)
652+
if args.cookie:
653+
cookie.load(args.cookie, ignore_discard=True, ignore_expires=True)
654+
args.login = get_page("/b/wlxt/kc/v_wlkc_xs_xktjb_coassb/queryxnxg") != err404
655+
print("login successfully" if args.login else "login failed!")
656+
else:
657+
login(args.username, args.password)
653658

654659
c["_type"] = {"0": "teacher", "3": "student"}[c["jslx"]]
655660
print("Sync " + c["xnxq"] + " " + c["kcm"])

0 commit comments

Comments
 (0)