def chaoxingDefault(): # 登陆 login() print("✅ 登陆成功!") print("⏳ 正在获取课程列表……") course = obj.get_course_list() # 输出 print_list(course) while True: # 异常输入判断 try: # 要求输入 id = int(input("课程id: ")) except ValueError: print("🚫 您输入的数据不符合规范!") continue if id == -1: exit(0) if id >= len(course) or id < 0: print("🚫 课程id不存在!") continue break # 输出选中的课程名称 print("\n<%s>" % course[id]['courseName']) # 获取课程目录 cata = obj.get_course_cata(course[id]['clazzid'], course[id]['cpi']) # 输出目录 print_tree(cata) # 执行自动化 eachProcessList(course, cata, course[id]['cpi'], course[id]['clazzid'], course[id]['courseId'])
def getCourseList(): # 登陆 login() # 获取 course = obj.get_course_list() # 输出 print_list(course, False)
ck = json.dumps(obj.s.cookies.items()) # 保存到文件 f = open("cookies.json", "w", encoding='utf-8') f.write(ck) f.close() else: print("登陆失败!") exit(-3) userId = obj.getUserInfo()['stuId'] print("正在获取课程列表……") course = obj.getCourseList()['courseList'] # 输出 print_list(course) while True: # 异常输入判断 try: # 要求输入 id = int(input("课程id: ")) except ValueError: print("您输入的数据不符合规范!") continue if id == -1: exit(0) if id >= len(course) or id < 0: print("课程id不存在!") continue break