🎉 欢迎访问GreasyFork.Org 镜像站!本镜像站由公众号【爱吃馍】搭建,用于分享脚本。联系邮箱📮

Greasy fork 爱吃馍镜像

超星学习通网课助手视频自动看非秒过

视频自动看,有的视频不支持秒过,本脚本是非秒过脚本,自动看视频,自动进入下一章

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

🚀 安装遇到问题?关注公众号获取帮助

公众号二维码

扫码关注【爱吃馍】

回复【脚本】获取最新教程和防失联地址

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

🚀 安装遇到问题?关注公众号获取帮助

公众号二维码

扫码关注【爱吃馍】

回复【脚本】获取最新教程和防失联地址

// ==UserScript==
// @name         超星学习通网课助手视频自动看非秒过
// @namespace    genggongzi_cx
// @version      0.2
// @description  视频自动看,有的视频不支持秒过,本脚本是非秒过脚本,自动看视频,自动进入下一章
// @author       genggongzi
// @match        *://*.chaoxing.com/*
// @match        *://*.edu.cn/*
// @connect      api.gochati.cn
// @connect      up.gochati.cn

// @run-at       document-end
// @grant        unsafeWindow
// @grant        GM_xmlhttpRequest
// @grant        GM_setClipboard
// @license      MIT
// @original-author qq:2621905853
// @original-license MIT
// ==/UserScript==

let lhost = window.location.host;
let lhref = window.location.href;
let lsearch = window.location.search;
let lpathname = window.location.pathname;

function sleepBySeconds(delay) {
    return new Promise(reslove => {
        setTimeout(reslove, delay * 1000)
    })
}
function sleepByMillis(delay) {
    return new Promise(reslove => {
        setTimeout(reslove, delay)
    })
}

let KCom = {
    isMain: function (obj) {
        return lhref.includes('/visit/interaction')
    },
    isStudyPage: function (obj) {
        return lhref.includes('mycourse/studentstudy')
    },
    isVideoPage: function (obj) {
        return lhref.includes('ananas/modules/video/')
    }
};

let tool = {
    eleLoad: function (dom, time, callback) {
        var tmm = window.setInterval(function () {
            if ($(dom).length == 0)
                return;
            window.clearInterval(tmm);
            callback();
        }, time);
    }
}

let Course = {
    endVideo: function () {
        window.setInterval(function () {
            if ($('video').length == 0)
                return;
            let Media = $('video')[0];

            if (Media.currentTime > 0 && Media.currentTime == Media.duration) {
                return;
            }
            if (Media.error != null) {
                if (Media.error.code == 2)
                    Media.load();
                Media.currentTime = Media.currentTime + 1;
            }
            $('video').prop('muted', true);
            Media.playbackRate = 2;
            if (Media.paused) {
                Media.play();
            }
        }, 1000)

    },
    playNext: function () {

    },
    videoHeart: function () {
        var flag = false;
        if ($('video').length == 0)
            return flag;
        var Media = $('video')[0];
        if (Media.paused) {
            flag = false;
        } else
            flag = true;
        return flag;
    }
};

let Pages = {

    mainPage: function () {
        if (!KCom.isMain()) {
            return
        }
    },
    studyPage: async function () {
        if (!KCom.isStudyPage()) {
            return
        }
        let chapters = $('div.posCatalog_level div.posCatalog_select')

        let firstEnter = true;
        for(let i = 0; i < chapters.length; i++) {
            if ($(chapters[i]).find('span.icon_Completed').length == 0 ) {

                console.log(i + ", " + $($('div.posCatalog_level div.posCatalog_select')[i]).find('.posCatalog_name')[0].title + ", " + firstEnter)
                if((firstEnter && !$('div.posCatalog_level div.posCatalog_select')[i].className.includes("posCatalog_active")) || !firstEnter) {
                    $(chapters[i]).find('span.posCatalog_name').eq(0).click()
                }
                firstEnter = false
                await sleepBySeconds(1)
                tool.eleLoad($('#prev_tab .prev_ul li[title="视频"]'), 500, function () {
                    $('#prev_tab .prev_ul li[title="视频"]').eq(0).click()
                });

                while ($($('div.posCatalog_level div.posCatalog_select')[i]).find('span.icon_Completed').length == 0) {
                    await sleepBySeconds(1)
                }
            }
        }
    },
    videoPage: async function () {
        if (!KCom.isVideoPage())
            return
        tool.eleLoad('#video_html5_api', 500, function () {
            console.log('开始点击播放')
            window.setInterval(function () {
                Course.endVideo();
            }, 2 * 1000)
        });

    }
};
console.log('进入视频正常版本(非秒过版本)')
Pages.videoPage()
window.setTimeout(Pages.studyPage, 2000);