Greasy Fork is available in English.
下载USTC网课回放
当前为
// ==UserScript==
// @name ustc网课下载
// @namespace https://www.bb.ustc.edu.cn/
// @version 0.2
// @description 下载USTC网课回放
// @author 398
// @match *://www.eeo.cn/*
// @grant none
// @run-at document-end
// ==/UserScript==
function exec(fn) {
var script = document.createElement('script');
script.setAttribute("type", "application/javascript");
script.textContent = '(' + fn + ')();';
document.body.appendChild(script);
document.body.removeChild(script);
}
exec(function() {
var mp4_path = null;
var path_scr = document.createElement('a');
setInterval(
//因为切换分P不会重载网页,这里用循环获取和更新地址
//原理是在已加载的内容中查找地址,不占用服务器
() => {
mp4_path = $("video[src$='.mp4']").attr('src');
path_scr.setAttribute('href', mp4_path);
path_scr.setAttribute('id', 'mp4-path');
path_scr.textContent = '下载链接';
if (document.getElementById('lesson-time').contains(path_scr)) {
document.getElementById('lesson-time').removeChild(path_scr);
};
document.getElementById('lesson-time').appendChild(path_scr);
//console.log("mp4_path",mp4_path);
},800)
});