// ==UserScript== // @name zqy爱学习 // @namespace http://tampermonkey.net/ // @version 2024-04-03 // @description 私人刷视频脚本 // @author fxalll // @match https://cela.gwypx.com.cn/portal/special_recommend_hot.do?infopush_id=48&menu=special&subjectId=1225&cela_sso_logged=true // @match https://cela.gwypx.com.cn/portal/course_detail.do?* // @match https://cela.gwypx.com.cn/portal/playnew.do?menu=course&* // @icon https://www.google.com/s2/favicons?sz=64&domain=gd.gov.cn // @license WTFPL // @grant none // @downloadURL none // ==/UserScript== (function() { 'use strict'; if (location.pathname === '/portal/special_recommend_hot.do') { // 专题课程页面 let doList = [] document.querySelectorAll('.h_pro_percent').forEach((e)=>{ if (e.innerText !== "100.0%") { doList.push(e) } }) if(doList[0] === undefined) { alert('当前所有视频已看完!') return; } else { console.log(`当前还有${doList.length}视频`) doList[0].click(); window.location.href = 'about:blank' window.close() } } else if(location.pathname === '/portal/course_detail.do') { // 进入课程页面 console.log("进入课程页面") function clickBtn() { console.log("点击按钮") document.querySelector('.hover_btn').click(); window.close(); } let interval1 = setInterval(()=>{ try{ clickBtn() clearInterval(interval1) }catch(err){ clickBtn() } },1000) } else if (location.pathname === '/portal/playnew.do') { // 如果打开了视频页面 console.log("进入视频页面") function detectVideo() { let videoEle = window.frames['course_frm'].contentDocument.querySelector('video'); if (videoEle.currentTime / videoEle.duration > 0.9995) { console.log("ok") window.open("https://cela.gwypx.com.cn/portal/special_recommend_hot.do?infopush_id=48&menu=special&subjectId=1225&cela_sso_logged=true") window.close(); } else { console.log(`还在看视频,目前进度${(videoEle.currentTime / videoEle.duration)*100}%`) } } let interval2 = setInterval(()=>{ detectVideo() },1000) } // Your code here... //window.frames['course_frame'].contentDocument.querySelector('.vjs-big-play-button').click() })();