您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
青书学堂 自动播放视频 自动挂课 自动下个视频 自动下个课程
当前为
// ==UserScript== // @name 【全自动】青书学堂挂课 // @namespace http://tampermonkey.net/ // @version 0.1 // @description 青书学堂 自动播放视频 自动挂课 自动下个视频 自动下个课程 // @author Yi // @match https://qingshuxuetang.com/* // @match https://*.qingshuxuetang.com/* // @match https://www.qingshuxuetang.com/* // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== // @grant None // ==/UserScript== (function() { 'use strict'; let domain = 'https://degree.qingshuxuetang.com/' let url=location.href; if (url.indexOf('Course/CourseList') > -1) { setTimeout(function() { console.log('currentCourse',currentCourse) sessionStorage.setItem('courses',JSON.stringify(currentCourse)) let course = currentCourse[0]; window.location.href=`${domain}cgjy/Student/Course/CourseStudy?courseId=${course.courseId}&teachPlanId=${course.teachPlanId}&periodId=${course.periodId}` }, 3000) }else if(url.indexOf('Course/CourseStudy') > -1){ setTimeout(function() { console.log('coursewareMedias',coursewareMedias) var videos=[]; getVideoNode(coursewareMedias,videos) console.log('videos',videos); let video = videos[0]; let courseId = getQueryString('courseId'); let teachPlanId = getQueryString('teachPlanId'); let periodId = getQueryString('periodId'); let videoMaps = {} videoMaps[courseId] = videos; sessionStorage.setItem('videos',JSON.stringify(videoMaps)) window.location.href=`https://degree.qingshuxuetang.com/cgjy/Student/Course/CourseShow?teachPlanId=${teachPlanId}&periodId=${periodId}&courseId=${courseId}&nodeId=${video.id}` }, 3000) }else if(url.indexOf('Course/CourseShow') > -1){ let courseId = getQueryString('courseId'); let nodeId = getQueryString('nodeId'); let videoMaps = JSON.parse(sessionStorage.getItem('videos')) let teachPlanId = getQueryString('teachPlanId'); let periodId = getQueryString('periodId'); let nextVideo = getNextVideo(nodeId,videoMaps[courseId]) setTimeout(function() { var video = document.getElementsByTagName("video")[0] //设置静音 video.muted = true //视频倍速 video.playbackRate = 2 //视频开始 video.play() const nextUrl = `https://degree.qingshuxuetang.com/cgjy/Student/Course/CourseShow?teachPlanId=${teachPlanId}&periodId=${periodId}&courseId=${courseId}&nodeId=${nextVideo}` // 下一条视频 video.addEventListener("ended",function(){ if(nextVideo == null){ let courses = JSON.parse(sessionStorage.getItem('courses')) let course = getNextCourse(courseId,courses) if(course == null){ window.location.href='https://baidu.com' } window.location.href=`${domain}cgjy/Student/Course/CourseStudy?courseId=${course.courseId}&teachPlanId=${course.teachPlanId}&periodId=${course.periodId}` }else{ location.replace(nextUrl); } }) }, 5000) getVideoTime() } function getNextVideo(current,videos){ let next =null; Array.prototype.forEach.call(videos,function (value,index) { if(value.id === current && videos.length-1 > index+1){ next = videos[index+1].id return false } }) return next; } function getNextCourse(current,courses){ let next =null; Array.prototype.forEach.call(courses,function (value,index) { if(value.courseId == current && courses.length-1 > index+1){ next = courses[index+1] return false } }) return next; } function getVideoNode(medias,videos){ Array.prototype.forEach.call(medias,function (value,index) { if(value.type === 'video'){ videos.push(value) } if(value.nodes !=null){ getVideoNode(value.nodes,videos) } }) } function getQueryString(name) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); var r = window.location.search.substr(1).match(reg); if (r != null) { return unescape(r[2]); } return null; } let currentVideoTime =null; function getVideoTime() { setInterval(function () { var vid = document.getElementsByTagName("video")[0] var currentTime = vid.currentTime.toFixed(1); if(currentTime == currentVideoTime){ console.log('视频卡住了,刷新~'); location.reload() } currentVideoTime = currentTime; console.log('视频时间:', currentTime); }, 5000); } })();