Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save lonelyion/308c63f1cb3b188658b86c33ba31388f to your computer and use it in GitHub Desktop.
Save lonelyion/308c63f1cb3b188658b86c33ba31388f to your computer and use it in GitHub Desktop.
上海大学超星资料直链获取
// ==UserScript==
// @name 上海大学超星资料直链获取
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Get direct download link of SHU's chaoxing files
// @author Lonely_ion
// @match http://mooc1.elearning.shu.edu.cn/coursedata?*
// @icon https://www.google.com/s2/favicons?domain=shu.edu.cn
// @require https://cdn.jsdelivr.net/npm/jquery@3.2.1/dist/jquery.min.js
// @grant none
// ==/UserScript==
(function() {
var trs = document.querySelectorAll("tr");
var ndiv = document.createElement("div");
trs.forEach(function(item) {
if(item.getAttribute('objectid')) {
var oid = item.getAttribute('objectid');
$.get('http://mooc1.elearning.shu.edu.cn/ananas/status/' + oid + '?flag=normal&_dc=' + Date.now(), function(data, status) {
var link = document.createElement('a');
var text = document.createTextNode(data.filename);
link.appendChild(text);
link.href = data.download;
link.target = '_blank';
link.style = "color: blue;";
ndiv.appendChild(link);
var linebreak = document.createElement('br');
ndiv.appendChild(linebreak);
});
}
});
var tmp = document.querySelector("div #pagination");
insertAfter(ndiv, tmp);
})();
function insertAfter(newNode, referenceNode) {
referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling);
}
@lonelyion
Copy link
Author

针对的是一些不能直接点下载的文件
20210615170951

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment