朝阳区教师学习服务平台刷课脚本分享
朝阳区教师学习服务平台
# 脚本介绍
该油猴脚本用于 朝阳区教师学习服务平台 的辅助看课,使用JavaScript编写,适配网址:http://yxw.bjchyedu.cn/
脚本功能如下:
- 视频自动播放 自动检测并播放页面中的视频
- 倍速播放调节 支持1.1倍-2.4倍速播放
- 自动静音功能 自动将视频设置为静音
- 防暂停检测 监听暂停事件并立即恢复
- 自动切课机制 视频播放完后自动跳转下一课
- 防检测系统 模拟用户鼠标和键盘活动
- 页面可见性伪装 防止检测标签页切换
脚本安装地址:
暂时下架
如果不会安装脚本,请按照下面安装教程来操作。
# 代学服务
提示
如需代学,请联系客服,支持闲鱼交易。

微信联系:yizhituziang

QQ联系:2422270452
- img: /img/weixin.jpg
name: 微信联系:yizhituziang
- img: /img/qq.jpg
name: QQ联系:2422270452
# 安装教程
# 1.安装浏览器扩展插件
首先需要给我们的浏览器安装上脚本猫插件,这是运行所有用户脚本的基础,如果浏览器已经安装过了脚本猫或者油猴插件,那么可以跳过这一步。推荐使用edge浏览器,安装插件更方便。
浏览器打开网址:https://docs.scriptcat.org/ (opens new window)
这里用edge浏览器作为示范,点击 "添加到Edge浏览器"

接着点击 "获取"

在右上角弹出的窗口,点击 "添加扩展"

等待几秒钟,会提示已经安装好脚本猫插件了。

# 2.安装刷课脚本
打开脚本安装地址后,在页面点击 "安装脚本" 按钮,接着在弹出的窗口点击 "安装" ,之后就会提示"安装成功"。
# 3.体验脚本功能
安装脚本后,需要重新进入学习站点,如果之前已经打开课程学习页面,那么需要刷新页面后脚本才会生效。
# 核心代码
class ChaoyangTeacherHelper {
constructor() {
this.options = {
autoPlayVideo: true,
playbackSpeed: 2.1,
autoMuteVideo: true,
autoNextLesson: true,
antiDetectionMode: true,
mainLoopDelay: 2200,
activityDelay: 25000,
maxRetryAttempts: 10
};
this.retryNumber = 0;
this.setup();
}
printLog(msg) {
console.log(`[朝阳教师学习] ${msg}`);
}
setup() {
this.printLog('脚本初始化中...');
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', () => {
this.launch();
});
} else {
this.launch();
}
this.modifyVisibility();
}
modifyVisibility() {
document.addEventListener('visibilitychange', (e) => {
e.stopImmediatePropagation();
}, true);
Object.defineProperty(document, 'hidden', {
get: function() { return false; }
});
Object.defineProperty(document, 'visibilityState', {
get: function() { return 'visible'; }
});
this.printLog('页面可见性已修改');
}
launch() {
this.printLog('朝阳区教师学习服务平台刷课脚本已启动');
setInterval(() => {
this.runLoop();
}, this.options.mainLoopDelay);
if (this.options.antiDetectionMode) {
setInterval(() => {
this.simulateUserBehavior();
}, this.options.activityDelay);
}
}
locateVideo() {
const selectorList = [
'video',
'.video-box video',
'#player video',
'.course-player video',
'.media-video video',
'[class*="video"] video',
'[id*="player"] video'
];
for (let index = 0; index < selectorList.length; index++) {
const videoElement = document.querySelector(selectorList[index]);
if (videoElement) {
this.printLog(`找到视频元素: ${selectorList[index]}`);
return videoElement;
}
}
return null;
}
adjustVideoSettings(video) {
if (!video) return;
if (this.options.autoMuteVideo && !video.muted) {
video.muted = true;
this.printLog('视频已静音');
}
if (video.playbackRate !== this.options.playbackSpeed) {
video.playbackRate = this.options.playbackSpeed;
this.printLog(`播放速度设置为 ${this.options.playbackSpeed}x`);
}
video.addEventListener('ratechange', () => {
if (video.playbackRate !== this.options.playbackSpeed) {
video.playbackRate = this.options.playbackSpeed;
}
});
}
tryPlayVideo(video) {
if (!video) return;
if (video.paused && !video.ended) {
this.printLog('检测到视频暂停,尝试播放');
video.play().then(() => {
this.printLog('视频播放成功');
this.retryNumber = 0;
}).catch(error => {
this.printLog(`播放失败: ${error.message}`);
this.retryNumber++;
if (this.retryNumber < this.options.maxRetryAttempts) {
this.printLog(`尝试点击播放按钮 (${this.retryNumber}/${this.options.maxRetryAttempts})`);
this.triggerPlayButton();
}
});
}
}
triggerPlayButton() {
const buttonList = [
'.play-control',
'.video-play-btn',
'.start-video',
'.vjs-control',
'.play-button',
'#play',
'[class*="play"]',
'button[title*="播放"]'
];
for (const selector of buttonList) {
const buttonElement = document.querySelector(selector);
if (buttonElement && buttonElement.offsetParent !== null) {
buttonElement.click();
this.printLog(`已点击播放按钮: ${selector}`);
break;
}
}
}
navigateToNextLesson() {
if (!this.options.autoNextLesson) return;
const video = this.locateVideo();
if (!video || !video.ended) return;
this.printLog('课程播放完毕,准备切换下一课');
const nextButtonList = [
'.next-lesson-btn',
'.next-chapter-btn',
'.btn-next-lesson',
'.lesson-nav-next',
'a[title*="下一课"]',
'a[title*="下一讲"]',
'[class*="next"]'
];
for (const selector of nextButtonList) {
const buttonElement = document.querySelector(selector);
if (buttonElement && buttonElement.offsetParent !== null) {
buttonElement.click();
this.printLog('已点击下一课按钮');
break;
}
}
}
simulateUserBehavior() {
if (!this.options.antiDetectionMode) return;
const xPos = Math.random() * window.innerWidth;
const yPos = Math.random() * window.innerHeight;
const mouseMoveEvent = new MouseEvent('mousemove', {
view: window,
bubbles: true,
cancelable: true,
clientX: xPos,
clientY: yPos
});
document.dispatchEvent(mouseMoveEvent);
const keyPressEvent = new KeyboardEvent('keydown', {
key: 'Shift',
bubbles: true
});
document.dispatchEvent(keyPressEvent);
if (Math.random() > 0.55) {
window.scrollBy(0, Math.random() > 0.5 ? 50 : -50);
}
this.printLog('模拟用户行为完成');
}
runLoop() {
const video = this.locateVideo();
if (video) {
this.adjustVideoSettings(video);
this.tryPlayVideo(video);
this.navigateToNextLesson();
}
}
}
new ChaoyangTeacherHelper();