超星学习通网课助手自动学习考试

开放优化收录系统,超过1600W自收录题库,支持自动答题,支持视频自动完成,章节测验自动答题提交,支持自动切换任务点等,开放自定义参数

目前为 2024-08-06 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name 超星学习通网课助手自动学习考试
  3. // @namespace genggongzi_cx
  4. // @version 1.0
  5. // @description 开放优化收录系统,超过1600W自收录题库,支持自动答题,支持视频自动完成,章节测验自动答题提交,支持自动切换任务点等,开放自定义参数
  6. // @author genggongzi
  7. // @match *://*.chaoxing.com/*
  8. // @match *://*.edu.cn/*
  9. // @connect api.gochati.cn
  10. // @connect up.gochati.cn
  11. // @run-at document-end
  12. // @grant unsafeWindow
  13. // @grant GM_xmlhttpRequest
  14. // @grant GM_setClipboard
  15. // @license MIT
  16. // @original-author qq:2621905853
  17. // @original-license MIT
  18. // ==/UserScript==
  19.  
  20. let lhost = window.location.host;
  21. let lhref = window.location.href;
  22. let lsearch = window.location.search;
  23. let lpathname = window.location.pathname;
  24.  
  25. function sleepBySeconds(delay) {
  26. return new Promise(reslove => {
  27. setTimeout(reslove, delay * 1000)
  28. })
  29. }
  30. function sleepByMillis(delay) {
  31. return new Promise(reslove => {
  32. setTimeout(reslove, delay)
  33. })
  34. }
  35.  
  36. let KCom = {
  37. isMain: function (obj) {
  38. return lhref.includes('/visit/interaction')
  39. },
  40. isStudyPage: function (obj) {
  41. return lhref.includes('mycourse/studentstudy')
  42. },
  43. isVideoPage: function (obj) {
  44. return lhref.includes('ananas/modules/video/')
  45. }
  46. };
  47.  
  48. let tool = {
  49. eleLoad: function (dom, time, callback) {
  50. var tmm = window.setInterval(function () {
  51. if ($(dom).length == 0)
  52. return;
  53. window.clearInterval(tmm);
  54. callback();
  55. }, time);
  56. }
  57. }
  58.  
  59. let Course = {
  60. endVideo: function () {
  61. if ($('video').length == 0)
  62. return;
  63. let Media = $('video')[0];
  64.  
  65. if (Media.currentTime > 0 && Media.currentTime == Media.duration) {
  66. return;
  67. }
  68. if (Media.error != null) {
  69. if (Media.error.code == 2)
  70. Media.load();
  71. Media.currentTime = Media.currentTime + 5;
  72. }
  73. $('video').prop('muted', true);
  74. Media.playbackRate = 2;
  75. if (Media.paused) {
  76. Media.play();
  77. }
  78.  
  79. console.log("当前元素:" + Media + ", 视频时间: " + Media.currentTime + ", duration: " + Media.duration)
  80. if (!isNaN(Media.duration)) {
  81. Media.currentTime = Media.duration
  82.  
  83. }
  84. },
  85. playNext: function () {
  86.  
  87. },
  88. videoHeart: function () {
  89. var flag = false;
  90. if ($('video').length == 0)
  91. return flag;
  92. var Media = $('video')[0];
  93. if (Media.paused) {
  94. flag = false;
  95. } else
  96. flag = true;
  97. return flag;
  98. }
  99. };
  100.  
  101. let Pages = {
  102.  
  103. mainPage: function () {
  104. if (!KCom.isMain()) {
  105. return
  106. }
  107. },
  108. studyPage: async function () {
  109. if (!KCom.isStudyPage()) {
  110. return
  111. }
  112. let chapters = $('div.posCatalog_level div.posCatalog_select')
  113.  
  114. let firstEnter = true;
  115. for(let i = 0; i < chapters.length; i++) {
  116. if ($(chapters[i]).find('span.icon_Completed').length == 0 ) {
  117.  
  118. console.log(i + ", " + $($('div.posCatalog_level div.posCatalog_select')[i]).find('.posCatalog_name')[0].title + ", " + firstEnter)
  119. if((firstEnter && !$('div.posCatalog_level div.posCatalog_select')[i].className.includes("posCatalog_active")) || !firstEnter) {
  120. $(chapters[i]).find('span.posCatalog_name').eq(0).click()
  121. }
  122. firstEnter = false
  123. await sleepBySeconds(1)
  124. tool.eleLoad($('#prev_tab .prev_ul li[title="视频"]'), 500, function () {
  125. $('#prev_tab .prev_ul li[title="视频"]').eq(0).click()
  126. });
  127.  
  128. while ($($('div.posCatalog_level div.posCatalog_select')[i]).find('span.icon_Completed').length == 0) {
  129. await sleepBySeconds(1)
  130. }
  131. }
  132. }
  133. },
  134. videoPage: async function () {
  135. if (!KCom.isVideoPage())
  136. return
  137. tool.eleLoad('#video_html5_api', 500, function () {
  138. console.log('开始点击播放')
  139. window.setInterval(function () {
  140. Course.endVideo();
  141. }, 2 * 1000)
  142. });
  143.  
  144. }
  145. };
  146.  
  147. Pages.videoPage()
  148. window.setTimeout(Pages.studyPage, 2000);
  149.  
  150.  

QingJ © 2025

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