chaoxing-download

超星慕课资源下载提取

目前為 2021-03-30 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name chaoxing-download
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.4.1
  5. // @description 超星慕课资源下载提取
  6. // @author NL
  7. // @match https://*.chaoxing.com/mycourse/studentstudy?*
  8. // @grant none
  9. // ==/UserScript==
  10. function setDl(){
  11. console.log('set dl was called')
  12. var iframes = document.getElementById("iframe").contentWindow.document.querySelectorAll("iframe")
  13. for(let i=0;i<iframes.length;i++){
  14. if(iframes[i].getAttribute("objectId")==null){
  15. continue
  16. }
  17. var url = "https://cs-ans.chaoxing.com/download/"+iframes[i].getAttribute("objectId")
  18. var a = document.createElement('a');
  19. a.setAttribute('href', url);
  20. a.setAttribute('class','downloadable-content')
  21. a.setAttribute('target','_blank')
  22. var textnode=document.createTextNode("↓下载课件")
  23. a.appendChild(textnode)
  24. if(iframes[i].parentElement.getElementsByClassName('downloadable-content').length==0){
  25.  
  26. iframes[i].parentNode.insertBefore(a,iframes[i])
  27. console.log("inserted"+i)
  28. } else {//console.log('inserted already')
  29. //console.log(iframes[i].parentElement.getElementsByClassName('downloadable-content'))
  30. }
  31. }
  32. }
  33. (function() {
  34. 'use strict';
  35. var old_text = "";
  36. console.log("downloader script running:");
  37. setTimeout(function (){
  38. old_text = document.getElementsByTagName("h1")[0].innerHTML;
  39. document.getElementsByTagName("h1")[0].innerHTML += "--->Waiting";
  40. },500);
  41. setTimeout(function(){
  42.  
  43. var parent_node = document.getElementsByClassName("goback")[0]
  44. var bt = document.createElement("button")
  45. bt.innerHTML = "刷新下载"
  46. bt.onclick = function(){setDl()}
  47. parent_node.appendChild(bt)
  48. },500);
  49. setTimeout(function(){
  50. document.getElementsByTagName("h1")[0].innerHTML = old_text
  51. //setDl()
  52. setInterval(setDl,2000)
  53. },1500);
  54. // Your code here...
  55. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址