魔学院自动播放脚本

魔学院视频自动播放(适配Microsoft Edge浏览器)

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

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

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        魔学院自动播放脚本
// @namespace    https://gitee.com/readpage
// @version      0.7
// @description  魔学院视频自动播放(适配Microsoft Edge浏览器)
// @author       readpage
// @match        https://*.study.moxueyuan.com/**
// @icon         https://wechat.moxueyuan.net/static/common/images/titleIcon/16.png
// @grant        none
// @license      MIT
// ==/UserScript==
const autoplay = ()=> {
    const url = window.location.href;
    if(url.indexOf("/course") != -1) {
        let video = document.querySelector('#player_html5_api')
        let timeNow = new Date();
        let hours = timeNow.getHours();
        //点击开始按钮
        document.querySelector('#player > button')?.click()
        //关闭提示
        document.querySelector('.dialog-footer-cancel.theme-bg-h-hover')?.click()
        //关闭播放结束提示
        document.querySelector('#app > div > section > main > div > div:nth-child(7) > div > div.el-dialog__footer > div > div > div.dialog-footer-cancel')?.click()
        if (video) {
           let next = document.querySelector('.course_list_progress_item.dis-flex.active + div')
           if(video.duration && video.duration - video.currentTime >= 30) {
              video.play()
           }
        }
    }
}

setInterval(() => {
    autoplay()
}, 2000)