督学网络学院-广东分院刷课脚本分享
督学网络学院-广东分院
# 脚本介绍
该油猴脚本用于 督学网络学院-广东分院 的辅助看课,使用JavaScript编写,适配网址:https://dx.tcc.edu.cn/h/gdfy/
脚本功能如下:
- 自动播放视频
- 视频倍速播放
- 自动完成课后练习
- 防止页面挂机检测
- 自动切换课程
脚本安装地址:
暂时下架
如果不会安装脚本,请按照下面安装教程来操作。
# 代学服务
提示
如需代学,请联系客服,支持闲鱼交易。

微信联系: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.体验脚本功能
安装脚本后,需要重新进入学习站点,如果之前已经打开课程学习页面,那么需要刷新页面后脚本才会生效。
# 核心代码
(function() {
'use strict';
const SCRIPT_INFO = {
name: '督学网络学院-广东分院刷课脚本',
version: '3.2.1',
author: '脚本喵'
};
console.log(`=== ${SCRIPT_INFO.name} v${SCRIPT_INFO.version} 已启动 ===`);
const Settings = {
ENABLE_AUTO_PLAY: true,
ENABLE_SPEED_CONTROL: true,
PLAYBACK_SPEED: 1.8,
ENABLE_AUTO_NEXT: true,
ENABLE_AUTO_QUIZ: true,
ENABLE_ANTI_DETECTION: true,
ENABLE_ACTIVITY_SIMULATION: true,
CHECK_FREQUENCY: 1500,
ACTIVITY_INTERVAL: 55000
};
const Helper = {
log: function(msg, type = 'info') {
const timestamp = new Date().toLocaleTimeString();
const prefix = `[${SCRIPT_INFO.name}][${timestamp}]`;
switch(type) {
case 'error':
console.error(prefix, msg);
break;
case 'warn':
console.warn(prefix, msg);
break;
default:
console.log(prefix, msg);
}
},
delay: function(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
},
random: function(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
};
async function initAntiDetection() {
Helper.log('初始化反检测模块...');
const originalAddEventListener = EventTarget.prototype.addEventListener;
EventTarget.prototype.addEventListener = function(eventName, handler, options) {
const blockedEvents = [
'visibilitychange', 'pagehide', 'pageshow',
'blur', 'focusout', 'mouseleave'
];
if (blockedEvents.includes(eventName)) {
Helper.log(`已拦截 ${eventName} 事件`);
return function() {};
}
return originalAddEventListener.call(this, eventName, handler, options);
};
Object.defineProperty(document, 'hidden', {
value: false,
writable: false,
configurable: false,
enumerable: true
});
Object.defineProperty(document, 'visibilityState', {
value: 'visible',
writable: false,
configurable: false,
enumerable: true
});
window.onblur = null;
window.onfocus = () => Helper.log('窗口焦点恢复');
Helper.log('反检测模块初始化完成');
}
function findVideo() {
const videoSelectors = [
'video',
'video[class*="player"]',
'.video-container video',
'#video-element video',
'.course-player video',
'[id*="video"] video'
];
for (const selector of videoSelectors) {
const video = document.querySelector(selector);
if (video) return video;
}
const iframes = document.querySelectorAll('iframe');
for (const iframe of iframes) {
try {
const iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
const video = iframeDoc.querySelector('video');
if (video) return video;
} catch (e) {
continue;
}
}
return null;
}
function configureVideo(video) {
if (!video) return;
Helper.log('配置视频播放器...');
video.muted = false;
video.volume = 1;
if (Settings.ENABLE_SPEED_CONTROL) {
Object.defineProperty(video, 'playbackRate', {
configurable: true,
get: () => Settings.PLAYBACK_SPEED,
set: () => Helper.log(`已锁定播放速度为 ${Settings.PLAYBACK_SPEED}x`)
});
}
video.addEventListener('pause', function(e) {
if (Settings.ENABLE_AUTO_PLAY && !video.ended) {
Helper.log('视频被暂停,尝试恢复播放');
setTimeout(() => {
video.play().catch(err => Helper.log('恢复播放失败: ' + err, 'error'));
}, 200);
}
});
video.addEventListener('ended', function() {
Helper.log('视频播放结束');
if (Settings.ENABLE_AUTO_NEXT) {
Helper.log('准备切换到下一个课程');
switchToNextCourse();
}
});
video.addEventListener('waiting', function() {
Helper.log('视频缓冲中...');
});
if (Settings.ENABLE_AUTO_PLAY && video.paused) {
video.play().catch(err => Helper.log('自动播放失败: ' + err, 'warn'));
}
Helper.log('视频播放器配置完成');
}
function switchToNextCourse() {
Helper.log('查找下一课按钮...');
const nextSelectors = [
'.next-course-btn',
'.next-lesson',
'#nextButton',
'[class*="next"]:not([disabled])',
'button:has(span:contains("下一"))',
'a:has(span:contains("下一节"))'
];
for (const selector of nextSelectors) {
const nextBtn = document.querySelector(selector);
if (nextBtn && !nextBtn.disabled && nextBtn.offsetParent !== null) {
Helper.log('找到下一课按钮,点击中...');
nextBtn.click();
return;
}
}
const courseList = document.querySelectorAll('.course-item, .lesson-item, .chapter-item');
for (let i = 0; i < courseList.length; i++) {
const item = courseList[i];
if (item.classList.contains('active') ||
item.classList.contains('current') ||
item.classList.contains('playing')) {
if (i + 1 < courseList.length) {
Helper.log('在课程列表中找到下一课');
courseList[i + 1].click();
return;
}
}
}
Helper.log('未找到下一课');
}
function autoSolveQuiz() {
if (!Settings.ENABLE_AUTO_QUIZ) return;
setInterval(() => {
const quizArea = document.querySelector('.quiz-area, .exercise-container, .test-panel');
if (!quizArea) return;
const options = quizArea.querySelectorAll('input[type="radio"], input[type="checkbox"], .option-item');
if (options.length > 0) {
Helper.log('检测到题目,自动作答中...');
const selectedOption = options[Helper.random(0, options.length - 1)];
if (selectedOption.tagName === 'INPUT') {
selectedOption.checked = true;
} else {
selectedOption.click();
}
const submitButton = quizArea.querySelector(
'button[type="submit"], .submit-btn, .confirm-btn, [class*="submit"]'
);
if (submitButton) {
setTimeout(() => {
submitButton.click();
Helper.log('答案已提交');
}, 800);
}
}
}, 2500);
}
function simulateUserBehavior() {
if (!Settings.ENABLE_ACTIVITY_SIMULATION) return;
const actions = [
() => {
window.scrollBy(0, Helper.random(-30, 30));
},
() => {
const x = Helper.random(0, window.innerWidth);
const y = Helper.random(0, window.innerHeight);
const moveEvent = new MouseEvent('mousemove', {
clientX: x,
clientY: y,
bubbles: true,
cancelable: true
});
document.dispatchEvent(moveEvent);
},
() => {
const keyEvent = new KeyboardEvent('keydown', {
key: 'Shift',
bubbles: true,
cancelable: true
});
document.dispatchEvent(keyEvent);
},
() => {
const x = Helper.random(100, window.innerWidth - 100);
const y = Helper.random(100, window.innerHeight - 100);
const clickEvent = new MouseEvent('click', {
clientX: x,
clientY: y,
bubbles: true,
cancelable: true
});
const target = document.elementFromPoint(x, y);
if (target && !target.closest('button') && !target.closest('a')) {
target.dispatchEvent(clickEvent);
}
}
];
setInterval(() => {
const actionIndex = Helper.random(0, actions.length - 1);
actions[actionIndex]();
Helper.log('模拟用户行为');
}, Settings.ACTIVITY_INTERVAL);
}
function monitorVideoPlayer() {
setInterval(() => {
const video = findVideo();
if (video) {
configureVideo(video);
}
}, Settings.CHECK_FREQUENCY);
}
async function initializeScript() {
Helper.log('开始初始化脚本...');
if (Settings.ENABLE_ANTI_DETECTION) {
await initAntiDetection();
}
monitorVideoPlayer();
autoSolveQuiz();
simulateUserBehavior();
Helper.log('脚本初始化完成!');
}
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', initializeScript);
} else {
initializeScript();
}
})();