Skip to content

Commit

Permalink
ver3.12.1更新
Browse files Browse the repository at this point in the history
  • Loading branch information
CXRunfree committed Apr 28, 2024
1 parent 461c7d2 commit 84885ae
Show file tree
Hide file tree
Showing 8 changed files with 105 additions and 270 deletions.
8 changes: 7 additions & 1 deletion .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 22 additions & 7 deletions Autovisor.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,22 @@ def auto_login(_user, _pwd, page):
page.evaluate(config.login_js)


def init_page(p, driver):
def init_page(p, driver, exe_path):
# 启动自带浏览器
if driver == "Chrome":
print("正在启动Chrome浏览器...")
browser = p.chromium.launch(channel="chrome", headless=False)
if not exe_path:
if driver == "Chrome":
print("正在启动Chrome浏览器...")
browser = p.chromium.launch(channel="chrome", headless=False)
else:
print("正在启动Edge浏览器...")
browser = p.chromium.launch(channel="msedge", headless=False)
else:
print("正在启动Edge浏览器...")
browser = p.chromium.launch(channel="msedge", headless=False)
if driver == "Chrome":
print("正在启动Chrome浏览器...")
browser = p.chromium.launch(executable_path=exe_path, channel="chrome", headless=False)
else:
print("正在启动Edge浏览器...")
browser = p.chromium.launch(executable_path=exe_path, channel="msedge", headless=False)
context = browser.new_context()
page = context.new_page()
# 设置程序超时时限
Expand All @@ -52,6 +60,10 @@ def optimize_page(page):
# 关闭上方横幅
page.wait_for_selector(".exploreTip", timeout=1000)
page.query_selector('a:has-text("不再提示")').click()
# 关闭公众号提示
page.evaluate(config.gjh_pop)
page.wait_for_selector(".warn-box", timeout=1000)
page.evaluate(config.close_gjh)
finally:
return

Expand Down Expand Up @@ -154,6 +166,8 @@ def start_course_loop(page, course_url):
while curtime != "100%":
try:
page.wait_for_timeout(1000)
if page.query_selector(".topic-item"):
skip_questions(page)
check_play(page)
curtime, total_time = get_progress(page)
time_period = (time.time() - start_time) / 60
Expand Down Expand Up @@ -188,7 +202,7 @@ def start_course_loop(page, course_url):

def main_function():
with sync_playwright() as p:
page, browser = init_page(p, driver)
page, browser = init_page(p, driver,exe_path)
# 进行登录
print("等待登录完成...")
auto_login(user, pwd, page)
Expand Down Expand Up @@ -221,6 +235,7 @@ def main_function():
user = config.username
pwd = config.password
driver = config.driver
exe_path = config.exe_path
urls = config.course_urls
if not isinstance(urls, list):
print('[Error]"Url"项格式错误!')
Expand Down
244 changes: 0 additions & 244 deletions Legacy/Autovisor_selenium.py

This file was deleted.

22 changes: 5 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,12 @@

------

#### 2024/4/18 rebuild-3.11.3~3.11.4 更新
#### 2024/4/28 rebuild-3.12.1 更新

**===== 3.11.4 ===== **

1.修复了完成所有课程时报错的问题

2.从此版本开始, 发行版将包含一份鸣谢名单, 以表达支持本项目的人的感谢~ !

**===== 3.11.3 ===== **

**1.新增部分自定义选项(运行中也可修改生效):**

- 支持自定义倍速大小;
- 支持自定义每门课程的刷课时长;

2.调整了课程链接的**填写方式**(更加人性化)

详细配置方式请见下方的 **"使用须知".**
- 支持自定义浏览器的路径;
- 修复了因弹出智慧树公众号导致程序卡住的bug;
- 增加对弹题的二次检测, 提高弹窗捕获率;
- 其他代码微调;

------

Expand Down
6 changes: 5 additions & 1 deletion configs.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ password =
;配置浏览器,可选Edge/Chrome
driver = Edge

;指定浏览器所在路径,不填则使用默认路径
;例如 C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe
EXE_PATH =

;限制每门课程刷课时长/min (不限制:0)
limitMaxTime = 30

Expand All @@ -18,4 +22,4 @@ limitSpeed = 1.8
URL1 = https://studyvideoh5.zhihuishu.com/stuStudy?recruitAndCourseId=***
URL2 = https://studyvideoh5.zhihuishu.com/stuStudy?recruitAndCourseId=***
URL3 = https://studyvideoh5.zhihuishu.com/stuStudy?recruitAndCourseId=***
URL4 = https://studyvideoh5.zhihuishu.com/stuStudy?recruitAndCourseId=***
URLn = https://studyvideoh5.zhihuishu.com/stuStudy?recruitAndCourseId=***
Binary file modified res/__pycache__/configs.cpython-310.pyc
Binary file not shown.

0 comments on commit 84885ae

Please sign in to comment.