# 华医网刷课脚本 **Repository Path**: tuziang/huayiwang ## Basic Information - **Project Name**: 华医网刷课脚本 - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-09-18 - **Last Updated**: 2025-09-18 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 华医网刷课脚本 ### 脚本介绍 该油猴脚本用于 华医网 的辅助看课,使用JavaScript编写,适配网址:https://*.91huayi.com/ **脚本功能如下:** 1.自动静音播放 2.自动切换视频 3.屏蔽课堂问答 4.自动考试 ●本脚本包含两个模式 “只看不考”模式:进入课程页面后,连续播放视频,无人值守 “全看遂考”模式:播完全部视频后进入考试 Ps小技巧:可以开“只看不考”模式将全部视频看完,最后再打开“全看遂考”模式,连续进入考试。其实直接开“全看遂考”也是会看完之后停留在考试二维码。 ●本脚本内置考试助手 人脸认证后,在考试中尝试A至E的答案,实现答题的效果。(目前还没有遇到多选之类的睿智问题) **脚本安装地址:** [https://scriptcat.org/zh-CN/script-show-page/4235](https://scriptcat.org/zh-CN/script-show-page/4235) 如果不会安装脚本,请按照下面安装教程来操作。 ### 代学服务 **如需代学,请联系客服,支持闲鱼交易。** - 微信联系:yizhituziang ![https://jiaobenmiao.com/img/weixin.jpg](https://jiaobenmiao.com/img/weixin.jpg) - QQ联系:2422270452 ![https://jiaobenmiao.com/img/qq.jpg](https://jiaobenmiao.com/img/qq.jpg) ### 安装教程 #### 1.安装浏览器扩展插件 首先需要给我们的浏览器安装上脚本猫插件,这是运行所有用户脚本的基础,如果浏览器已经安装过了脚本猫或者油猴插件,那么可以跳过这一步。推荐使用edge浏览器,安装插件更方便。 浏览器打开网址:[https://docs.scriptcat.org/](https://docs.scriptcat.org/) 这里用edge浏览器作为示范,点击 **“添加到Edge浏览器”** ![image-20250916183549234](https://jiaobenmiao.com/articleimg/image-20250916183549234.png) 接着点击 **“获取”** ![image-20250916183818025](https://jiaobenmiao.com/articleimg/image-20250916183818025.png) 在右上角弹出的窗口,点击 **“添加扩展”** ![image-20250916183841569](https://jiaobenmiao.com/articleimg/image-20250916183841569.png) 等待几秒钟,会提示已经安装好脚本猫插件了。 ![image-20250916183906107](https://jiaobenmiao.com/articleimg/image-20250916183906107.png) #### 2.安装刷课脚本 打开脚本安装地址后,在页面点击 **“安装脚本”** 按钮,接着在弹出的窗口点击 **“安装”** ,之后就会提示“安装成功”。 #### 3.体验脚本功能 安装脚本后,需要重新进入学习站点,如果之前已经打开课程学习页面,那么需要刷新页面后脚本才会生效。 ### 核心代码 ```js // 设置定时器一直检测,每10s检测一次 if (state == "已完成" || state == "待考试" || !hreftest) {//value不为#说明考试按钮已经激活 console.log("已经播放完了"); if (document.querySelector("a[id='mode']").innerText.indexOf("视频+考试") != -1 && state == "待考试") { console.log("mode=2,阿み杰准备进入考试"); try { clickexam(); } catch (error) { console.log("扫码进入考试"); window.open("/pages/exam_tip.aspx?cwrid=" + cwrid, "_self"); }; } else { if (document.querySelector("a[id='mode']").innerText.indexOf("视频+考试") != -1) { console.log("mode=2,本节课已完成"); } else { console.log("mode=1,准备单刷视频"); }; //自动播放下一个视频的 const targetElements = document.querySelectorAll("i[id='top_play']"); const parentElement = targetElements[0].parentElement; const grandparentElement = parentElement.parentElement; const lis = document.querySelectorAll("li[class='lis-inside-content']"); var index = Array.from(lis).findIndex(li => li === grandparentElement);//找出当前页面是第几个课程 console.log(index); if (index + 2 <= document.querySelectorAll("li[class='lis-inside-content']").length) { index += 2; console.log("新的Index:" + index); document.querySelector("#top_body > div.video-container > div.page-container > div.page-content > ul > li:nth-child(" + index + ") > h2").click(); setTimeout(function () { document.evaluate("//button[contains(., '知道了')]", document, null, XPathResult.ANY_TYPE).iterateNext().click(); }, 2000); } else { // 尝试点击第一个按钮 if ($('button:contains("未学习")').length > 0) { $('button:contains("未学习")').siblings().eq(0).click(); } else if ($('button:contains("学习中")').length > 0) { // 如果第一个按钮没有找到,尝试点击第二个按钮 $('button:contains("学习中")').siblings().eq(0).click(); } else if ($('button:contains("待考试")').length > 0 && document.querySelector("a[id='mode']").innerText.indexOf("视频+考试") != -1) { // 如果前两个按钮都没有找到,尝试点击第三个按钮 $('button:contains("待考试")').siblings().eq(0).click(); } else { // 如果所有按钮都没有找到,执行其他操作或者提示用户 console.log('没有找到任何按钮'); clearInterval(clock); // 或者执行其他逻辑 }; }; }; } else {//#代表考试按钮还没激活 //继续播放,无需任何操作 }; ```