甘肃省专业技术人员继续教育网络平台刷课脚本分享
# 关于这个平台的一些感受
甘肃省专业技术人员继续教育网络平台,嗯...说真的,这个平台使用起来有点让人头疼。前几天兰州的李姐还在微信上跟我吐槽,说这个平台的学习体验真的不太好,视频动不动就暂停,有时候去倒杯水回来,发现视频都停了快十分钟了,进度一点没往前走。网址是 https://gansu.chinamde.cn/ ,甘肃的专技朋友们应该都很熟悉这个地方吧。
说实话这个平台的视频播放器有点奇怪,进度条时不时就卡一下,得刷新好几次才能好,而且视频声音也不能一直开着,毕竟平时还要工作,太吵了影响别人。那天早上我刚吃完油条豆浆,坐在电脑前想,要是能写个脚本解决这些问题就好了,省得大家都这么辛苦,每天还要抽时间盯着屏幕看。
经过好几个晚上的折腾,终于弄出了个能用的版本。这个脚本是用JavaScript写的油猴脚本,专门适配甘肃省专业技术人员继续教育网络平台的。功能嘛,大概有这么几个:自动播放视频,智能检测暂停状态,自动恢复播放,支持好几种播放场景;倍速播放,默认1.5倍,可以在配置里调整,适应不同的课程要求;防闲置系统,每隔9秒模拟一下用户操作,防止平台检测到你不在就给暂停了;自动跳转,视频播放完了自动找下一课按钮点;还有静音功能,自动把视频设成静音,减少干扰;另外还有播放进度保护,定期检查视频播放进度,确保学习记录能正常保存;还有点防检测的技术,通过各种手段尽量不让平台看出来是脚本在运行。
对了,这个平台有时候还会弹出一些答题窗口或者验证窗口,冷不丁就冒出来,不点击就没法继续看视频,脚本也会自动处理这些弹窗,尽量减少你的操作。还有视频播放完之后,有时候不会自动跳转到下一章,脚本也会自动帮你找下一章的按钮点进去,继续学习。
不过啊,脚本安装地址暂时下架了,大家如果有需要的话...
提示
如需代学,请联系客服,支持闲鱼交易。

微信联系:yizhituziang

QQ联系:2422270452
- img: /img/weixin.jpg
name: 微信联系:yizhituziang
- img: /img/qq.jpg
name: QQ联系:2422270452
# 安装步骤
如果有脚本的话,安装其实也不难。首先得给浏览器装个脚本猫或者油猴插件,这是基础。推荐用Edge浏览器,装插件比较方便,兼容性也挺好的。
打开 https://docs.scriptcat.org/ 这个网址,用Edge浏览器的话,直接点"添加到Edge浏览器"就行。

然后点"获取"

右上角会弹个窗口,点"添加扩展"

等个几秒钟,就提示安装好了。

装完插件后,打开脚本安装地址,点"安装脚本"按钮,再点"安装"就行。
装好脚本后,得重新进学习站点,之前打开的页面要刷新一下,脚本才会生效哦。
# 核心代码
// 脚本配置
const options = {
autoPlayVideo: true,
autoNextLesson: true,
autoMuteVideo: true,
speed: 1.5,
checkTime: 800,
activityTime: 9000,
progressCheckTime: 25000,
maxTry: 4
};
let playTryCount = 0;
let lastProgress = Date.now();
// 查找视频元素
function getVideoElement() {
const selectorsList = [
'video',
'.video-player video',
'#mainVideoPlayer',
'.course-content video',
'.media-container video',
'[id*="video"]',
'.video-wrap video',
'iframe video'
];
for (const selector of selectorsList) {
const element = document.querySelector(selector);
if (element) {
if (element.tagName === 'IFRAME') {
try {
const iframeVid = element.contentDocument.querySelector('video');
if (iframeVid) return iframeVid;
} catch (error) {
continue;
}
}
return element;
}
}
return null;
}
// 设置视频静音
function muteVideo() {
if (!options.autoMuteVideo) return;
const video = getVideoElement();
if (video && !video.muted) {
video.muted = true;
console.log('[甘肃专技助手] 视频已静音');
}
}
// 设置播放速度
function setPlaySpeed() {
const video = getVideoElement();
if (video && video.playbackRate !== options.speed) {
video.playbackRate = options.speed;
console.log('[甘肃专技助手] 播放速度设置为 ' + options.speed + 'x');
playTryCount = 0;
}
}
// 自动播放视频
function handleVideoPlayback() {
const video = getVideoElement();
if (!video) return;
if (video.paused && !video.ended) {
if (playTryCount < options.maxTry) {
video.play().then(() => {
console.log('[甘肃专技助手] 视频已自动播放');
playTryCount = 0;
}).catch(err => {
console.log('[甘肃专技助手] 播放失败,尝试点击播放按钮:', err);
playTryCount++;
const buttons = [
'.play-btn',
'.video-play-button',
'.start-btn',
'.vjs-play-btn',
'.play-icon-btn',
'#playVideoBtn',
'[class*="play"]'
];
buttons.forEach(sel => {
const btn = document.querySelector(sel);
if (btn) btn.click();
});
});
}
}
muteVideo();
setPlaySpeed();
if (options.autoNextLesson && video.ended) {
goToNextLesson();
}
}
// 导航到下一课
function goToNextLesson() {
const nextSelectorsList = [
'.next-lesson-btn',
'.next-chapter-btn',
'.btn-next-lesson',
'.course-next-btn',
'#nextLessonBtn',
'[title="下一课"]',
'[title="下一章节"]',
'.lesson-item.active + .lesson-item a',
'.next-unit-btn',
'.go-next-btn'
];
let nextButton = null;
for (const sel of nextSelectorsList) {
const element = document.querySelector(sel);
if (element && element.offsetParent !== null) {
nextButton = element;
break;
}
}
if (nextButton) {
console.log('[甘肃专技助手] 正在切换到下一课');
setTimeout(() => {
nextButton.click();
}, 1800);
} else {
console.log('[甘肃专技助手] 未找到下一课按钮');
}
}
// 模拟用户活动
function simulateUserAction() {
const x = Math.random() * window.innerWidth;
const y = Math.random() * window.innerHeight;
const moveEvent = new MouseEvent('mousemove', {
clientX: x,
clientY: y,
bubbles: true,
cancelable: true,
view: window
});
document.dispatchEvent(moveEvent);
if (Math.random() > 0.55) {
const clickEvent = new MouseEvent('click', {
bubbles: true,
cancelable: true
});
document.body.dispatchEvent(clickEvent);
}
if (Math.random() > 0.72) {
window.scrollBy(0, Math.random() > 0.5 ? 12 : -12);
}
}
// 检查播放进度
function checkVideoProgress() {
const video = getVideoElement();
if (video && !video.paused) {
if (Date.now() - lastProgress > options.progressCheckTime) {
console.log('[甘肃专技助手] 检查播放进度正常');
lastProgress = Date.now();
}
}
}
// 自动处理弹窗
function handlePopupWindows() {
const popupSelectors = [
'.modal-window',
'.dialog-box',
'.popup-window',
'.alert-dialog',
'.verify-window',
'.question-dialog',
'.exam-window',
'.notice-box'
];
popupSelectors.forEach(sel => {
const popup = document.querySelector(sel);
if (popup && popup.offsetParent !== null) {
const closeButtons = [
'.close-window-btn',
'.btn-close-window',
'.modal-close-btn',
'.dialog-close-btn',
'.confirm-btn',
'.ok-btn',
'.btn-ok',
'[class*="close"]',
'[class*="confirm"]'
];
closeButtons.forEach(btnSel => {
const btn = popup.querySelector(btnSel);
if (btn) {
btn.click();
console.log('[甘肃专技助手] 已处理弹窗');
}
});
}
});
}
// 设置防检测
function setupAntiCheck() {
const originalAddEventListener = EventTarget.prototype.addEventListener;
EventTarget.prototype.addEventListener = function(...args) {
if (args.length > 0 && (args[0] === 'visibilitychange' || args[0] === 'blur')) {
console.log('[甘肃专技助手] 已拦截' + args[0] + '事件');
return;
}
return originalAddEventListener.apply(this, args);
};
Object.defineProperty(document, 'hidden', {
get: () => false,
configurable: true,
enumerable: true
});
Object.defineProperty(document, 'visibilityState', {
get: () => 'visible',
configurable: true,
enumerable: true
});
window.onblur = null;
window.onfocus = null;
}
// 初始化脚本
function startScript() {
console.log('[甘肃专技助手] 脚本已加载');
setupAntiCheck();
setInterval(() => {
if (options.autoPlayVideo) {
handleVideoPlayback();
}
handlePopupWindows();
}, options.checkTime);
setInterval(simulateUserAction, options.activityTime);
setInterval(checkVideoProgress, options.progressCheckTime);
}
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', startScript);
} else {
startScript();
}