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

微信联系: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 CUGTrainingHelper {
constructor() {
this.config = {
autoPlay: true,
speed: 2.5,
autoMute: true,
autoNext: true,
antiDetect: true,
loopInterval: 1700,
activityInterval: 19000,
retries: 7
};
this.currentRetries = 0;
this.init();
}
log(text) {
console.log(`[地大培训在线] ${text}`);
}
init() {
this.log('脚本正在初始化...');
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', () => {
this.start();
});
} else {
this.start();
}
this.patchVisibility();
}
patchVisibility() {
document.addEventListener('visibilitychange', function(event) {
event.stopImmediatePropagation();
}, true);
Object.defineProperty(document, 'hidden', {
get: () => false
});
Object.defineProperty(document, 'visibilityState', {
get: () => 'visible'
});
this.log('页面可见性已修复');
}
start() {
this.log('地大培训在线刷课脚本已启动');
setInterval(() => {
this.mainLoop();
}, this.config.loopInterval);
if (this.config.antiDetect) {
setInterval(() => {
this.simulateActivity();
}, this.config.activityInterval);
}
}
getVideoElement() {
const videoSelectors = [
'video',
'.player video',
'#coursePlayer video',
'.lesson-video video',
'.video-player video',
'[class*="video"] video',
'[id*="player"] video'
];
for (let i = 0; i < videoSelectors.length; i++) {
const video = document.querySelector(videoSelectors[i]);
if (video) {
this.log(`视频元素已定位: ${videoSelectors[i]}`);
return video;
}
}
return null;
}
setupVideo(video) {
if (!video) return;
if (this.config.autoMute && !video.muted) {
video.muted = true;
this.log('视频已设置为静音');
}
if (video.playbackRate !== this.config.speed) {
video.playbackRate = this.config.speed;
this.log(`播放倍速已调整为 ${this.config.speed}x`);
}
video.addEventListener('ratechange', () => {
if (video.playbackRate !== this.config.speed) {
video.playbackRate = this.config.speed;
}
});
}
playVideo(video) {
if (!video) return;
if (video.paused && !video.ended) {
this.log('检测到视频暂停,正在恢复播放');
video.play().then(() => {
this.log('视频恢复播放成功');
this.currentRetries = 0;
}).catch(err => {
this.log(`自动播放失败: ${err.message}`);
this.currentRetries++;
if (this.currentRetries < this.config.retries) {
this.log(`尝试点击播放按钮 (${this.currentRetries}/${this.config.retries})`);
this.clickPlayButton();
}
});
}
}
clickPlayButton() {
const buttonSelectors = [
'.play',
'.video-start-btn',
'.play-video',
'.vjs-play',
'.play-btn',
'#playVideoBtn',
'[class*="play"]',
'button[title*="播放"]'
];
for (const selector of buttonSelectors) {
const button = document.querySelector(selector);
if (button && button.offsetParent !== null) {
button.click();
this.log(`已点击播放按钮: ${selector}`);
break;
}
}
}
nextLesson() {
if (!this.config.autoNext) return;
const video = this.getVideoElement();
if (!video || !video.ended) return;
this.log('课程播放完成,准备切换下一课');
const nextButtonSelectors = [
'.next-chapter',
'.next-lesson',
'.btn-next',
'.lesson-next',
'a[title*="下一课"]',
'a[title*="下一讲"]',
'[class*="next"]'
];
for (const selector of nextButtonSelectors) {
const button = document.querySelector(selector);
if (button && button.offsetParent !== null) {
button.click();
this.log('已点击下一课按钮');
break;
}
}
}
simulateActivity() {
if (!this.config.antiDetect) return;
const posX = Math.random() * window.innerWidth;
const posY = Math.random() * window.innerHeight;
const mouseEvent = new MouseEvent('mousemove', {
view: window,
bubbles: true,
cancelable: true,
clientX: posX,
clientY: posY
});
document.dispatchEvent(mouseEvent);
const keyEvent = new KeyboardEvent('keydown', {
key: 'CapsLock',
bubbles: true
});
document.dispatchEvent(keyEvent);
if (Math.random() > 0.45) {
window.scrollBy(0, Math.random() > 0.5 ? 38 : -38);
}
this.log('已模拟用户活动');
}
mainLoop() {
const video = this.getVideoElement();
if (video) {
this.setupVideo(video);
this.playVideo(video);
this.nextLesson();
}
}
}
new CUGTrainingHelper();