From 315d26af3a46c35c6ab7b4076784f3d684962de0 Mon Sep 17 00:00:00 2001 From: JesterHey Date: Sun, 10 Mar 2024 19:06:10 +0800 Subject: [PATCH] modified: course_info.json modified: demo.py modified: main.py modified: single_course.py --- course_info.json | 158 ++++++++++++++++++++++++++++++++++++++++++++++- demo.py | 10 ++- main.py | 21 ++++++- single_course.py | 9 +++ 4 files changed, 190 insertions(+), 8 deletions(-) diff --git a/course_info.json b/course_info.json index 939ed27..6331538 100644 --- a/course_info.json +++ b/course_info.json @@ -1 +1,157 @@ -{"7367": {"rate": 100, "type": "\u5fc5\u4fee", "status": "\u5df2\u5b66\u5b8c"}, "7366": {"rate": 100, "type": "\u5fc5\u4fee", "status": "\u5df2\u5b66\u5b8c"}, "7033": {"rate": 100, "type": "\u5fc5\u4fee", "status": "\u5df2\u5b66\u5b8c"}, "7517": {"rate": 100, "type": "\u5fc5\u4fee", "status": "\u5df2\u5b66\u5b8c"}, "7032": {"rate": 100, "type": "\u5fc5\u4fee", "status": "\u5df2\u5b66\u5b8c"}, "7516": {"rate": 100, "type": "\u5fc5\u4fee", "status": "\u5df2\u5b66\u5b8c"}, "7031": {"rate": 100, "type": "\u5fc5\u4fee", "status": "\u5df2\u5b66\u5b8c"}, "7515": {"rate": 100, "type": "\u5fc5\u4fee", "status": "\u5df2\u5b66\u5b8c"}, "6349": {"rate": 100, "type": "\u5fc5\u4fee", "status": "\u5df2\u5b66\u5b8c"}, "7436": {"rate": 100, "type": "\u5fc5\u4fee", "status": "\u5df2\u5b66\u5b8c"}, "6937": {"rate": 100, "type": "\u57f9\u8bad", "status": "\u672a\u8bc4\u5206"}, "6938": {"rate": 100, "type": "\u57f9\u8bad", "status": "\u672a\u8bc4\u5206"}, "6991": {"rate": 15, "type": "\u57f9\u8bad", "status": "\u672a\u5b66\u5b8c"}, "6992": {"rate": 100, "type": "\u57f9\u8bad", "status": "\u5df2\u5b66\u5b8c"}, "6993": {"rate": 100, "type": "\u57f9\u8bad", "status": "\u5df2\u5b66\u5b8c"}, "6995": {"rate": 100, "type": "\u57f9\u8bad", "status": "\u5df2\u5b66\u5b8c"}, "7006": {"rate": 100, "type": "\u57f9\u8bad", "status": "\u5df2\u5b66\u5b8c"}, "7007": {"rate": 100, "type": "\u57f9\u8bad", "status": "\u5df2\u5b66\u5b8c"}, "7010": {"rate": 100, "type": "\u57f9\u8bad", "status": "\u5df2\u5b66\u5b8c"}, "7011": {"rate": 100, "type": "\u57f9\u8bad", "status": "\u5df2\u5b66\u5b8c"}, "7554": {"rate": 100, "type": "\u9009\u4fee", "status": "\u5df2\u5b66\u5b8c"}, "7553": {"rate": 100, "type": "\u9009\u4fee", "status": "\u5df2\u5b66\u5b8c"}, "7552": {"rate": 100, "type": "\u9009\u4fee", "status": "\u5df2\u5b66\u5b8c"}, "7551": {"rate": 100, "type": "\u9009\u4fee", "status": "\u5df2\u5b66\u5b8c"}, "7550": {"rate": 100, "type": "\u9009\u4fee", "status": "\u5df2\u5b66\u5b8c"}, "7549": {"rate": 100, "type": "\u9009\u4fee", "status": "\u5df2\u5b66\u5b8c"}, "7548": {"rate": 100, "type": "\u9009\u4fee", "status": "\u5df2\u5b66\u5b8c"}, "7547": {"rate": 100, "type": "\u9009\u4fee", "status": "\u5df2\u5b66\u5b8c"}, "7546": {"rate": 100, "type": "\u9009\u4fee", "status": "\u5df2\u5b66\u5b8c"}, "7545": {"rate": 100, "type": "\u9009\u4fee", "status": "\u5df2\u5b66\u5b8c"}, "7564": {"rate": 100, "type": "\u9009\u4fee", "status": "\u5df2\u5b66\u5b8c"}} \ No newline at end of file +{ + "7367": { + "rate": 100, + "type": "\u5fc5\u4fee", + "status": "\u5df2\u5b66\u5b8c" + }, + "7366": { + "rate": 100, + "type": "\u5fc5\u4fee", + "status": "\u5df2\u5b66\u5b8c" + }, + "7033": { + "rate": 100, + "type": "\u5fc5\u4fee", + "status": "\u5df2\u5b66\u5b8c" + }, + "7517": { + "rate": 100, + "type": "\u5fc5\u4fee", + "status": "\u5df2\u5b66\u5b8c" + }, + "7032": { + "rate": 100, + "type": "\u5fc5\u4fee", + "status": "\u5df2\u5b66\u5b8c" + }, + "7516": { + "rate": 100, + "type": "\u5fc5\u4fee", + "status": "\u5df2\u5b66\u5b8c" + }, + "7031": { + "rate": 100, + "type": "\u5fc5\u4fee", + "status": "\u5df2\u5b66\u5b8c" + }, + "7515": { + "rate": 100, + "type": "\u5fc5\u4fee", + "status": "\u5df2\u5b66\u5b8c" + }, + "6349": { + "rate": 100, + "type": "\u5fc5\u4fee", + "status": "\u5df2\u5b66\u5b8c" + }, + "7436": { + "rate": 100, + "type": "\u5fc5\u4fee", + "status": "\u5df2\u5b66\u5b8c" + }, + "6937": { + "rate": 100, + "type": "\u57f9\u8bad", + "status": "\u672a\u8bc4\u5206" + }, + "6938": { + "rate": 100, + "type": "\u57f9\u8bad", + "status": "\u672a\u8bc4\u5206" + }, + "6991": { + "rate": 15, + "type": "\u57f9\u8bad", + "status": "\u672a\u5b66\u5b8c" + }, + "6992": { + "rate": 100, + "type": "\u57f9\u8bad", + "status": "\u5df2\u5b66\u5b8c" + }, + "6993": { + "rate": 100, + "type": "\u57f9\u8bad", + "status": "\u5df2\u5b66\u5b8c" + }, + "6995": { + "rate": 100, + "type": "\u57f9\u8bad", + "status": "\u5df2\u5b66\u5b8c" + }, + "7006": { + "rate": 100, + "type": "\u57f9\u8bad", + "status": "\u5df2\u5b66\u5b8c" + }, + "7007": { + "rate": 100, + "type": "\u57f9\u8bad", + "status": "\u5df2\u5b66\u5b8c" + }, + "7010": { + "rate": 100, + "type": "\u57f9\u8bad", + "status": "\u5df2\u5b66\u5b8c" + }, + "7011": { + "rate": 100, + "type": "\u57f9\u8bad", + "status": "\u5df2\u5b66\u5b8c" + }, + "7554": { + "rate": 100, + "type": "\u9009\u4fee", + "status": "\u5df2\u5b66\u5b8c" + }, + "7553": { + "rate": 100, + "type": "\u9009\u4fee", + "status": "\u5df2\u5b66\u5b8c" + }, + "7552": { + "rate": 100, + "type": "\u9009\u4fee", + "status": "\u5df2\u5b66\u5b8c" + }, + "7551": { + "rate": 100, + "type": "\u9009\u4fee", + "status": "\u5df2\u5b66\u5b8c" + }, + "7550": { + "rate": 100, + "type": "\u9009\u4fee", + "status": "\u5df2\u5b66\u5b8c" + }, + "7549": { + "rate": 100, + "type": "\u9009\u4fee", + "status": "\u5df2\u5b66\u5b8c" + }, + "7548": { + "rate": 100, + "type": "\u9009\u4fee", + "status": "\u5df2\u5b66\u5b8c" + }, + "7547": { + "rate": 100, + "type": "\u9009\u4fee", + "status": "\u5df2\u5b66\u5b8c" + }, + "7546": { + "rate": 100, + "type": "\u9009\u4fee", + "status": "\u5df2\u5b66\u5b8c" + }, + "7545": { + "rate": 100, + "type": "\u9009\u4fee", + "status": "\u5df2\u5b66\u5b8c" + }, + "7564": { + "rate": 100, + "type": "\u9009\u4fee", + "status": "\u5df2\u5b66\u5b8c" + } +} \ No newline at end of file diff --git a/demo.py b/demo.py index 72c0495..4e3b81f 100644 --- a/demo.py +++ b/demo.py @@ -1,6 +1,4 @@ -from loguru import logger - -# 自定义日志格式 -logger.add("file.log", format="{time} {level} {message}", level="DEBUG") - -logger.debug("这是一条具有自定义格式的日志信息") +from DrissionPage import ChromiumPage +from DrissionPage.common import * +page = ChromiumPage() +page.ele('tag:a@@text():是').click() \ No newline at end of file diff --git a/main.py b/main.py index 82ce4b5..e7644b9 100644 --- a/main.py +++ b/main.py @@ -39,4 +39,23 @@ for k, v in new_cnt.items(): # 若上述检验通过,则重新读取课程信息并检验是否存在未答题或者未评分的课程 new_cnt = new_info() -# 睡午觉了,下午写吧,哈哈 +not_judged = [] +not_quiz = [] +for k, v in new_cnt.items(): + if v['status'] == '已完成': + continue + if v['status'] == '未评分': + not_judged.append(k) + else: + not_quiz.append(k) + +# 展示提示信息 +for i in not_judged: + logger.warning('存在未评分的课程:{}'.format(i)) +# 实现自动评分 +def auto_judge(course_id:str) -> None: + pass +for i in not_judged: + logger.warning('存在未答题的课程:{}'.format(i)) +# 实现自动答题 +pass \ No newline at end of file diff --git a/single_course.py b/single_course.py index 2f699bf..170db38 100644 --- a/single_course.py +++ b/single_course.py @@ -72,8 +72,17 @@ def one_course(cid:str,ctype:str,crate:int,again:bool=False): break ''' 由于视频播完后会自动暂停,所以需要检测是否播放完毕以准备下一步操作 + 有多个小节会提示是否进入下一小节,所以需要检测是否有进入下一小节的按钮 解决方案:检测列表中首个不是100的元素的索引,根据索引点击对应的视频,并尝试检测是否有播放按钮来区分正在播放和播放完毕 ''' + + # 每60秒先检测是否有视频播放完毕 + try: + if tab.ele('tag:div@@text():本小结已经学习完,是否进入下一节?',timeout=2): + tab.ele('tag:a@@text():是').click() + except: + pass + # 有时候没有弹窗提示,用以下方式手动检测 for i in l: if i != 100: tab.ele('#normalModel_nodeList').eles('tag:div')[l.index(i)].click()