您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
提取视频字幕文件,显示于视频下方,便于搜索内容
// ==UserScript== // @name 中国大学MOOC 字幕提取 // @namespace http://tampermonkey.net/ // @version 0.1 // @description 提取视频字幕文件,显示于视频下方,便于搜索内容 // @author r4phael // @match *://www.icourse163.org/learn/* // @match *://www.icourse163.org/spoc/learn/* // @grant none // ==/UserScript== (function (open) { XMLHttpRequest.prototype.open = function () { this.addEventListener("readystatechange", function () { if (this.responseURL.indexOf('CourseBean.getLessonUnitLearnVo.dwr') >= 0) { var data = this.responseText; var srtUrl = data.match("s0\.url=\"(.*)\";"); var httpRequest = new XMLHttpRequest(); httpRequest.open('GET', srtUrl[1], true); httpRequest.send(); httpRequest.onreadystatechange = function () { if (httpRequest.readyState == 4 && httpRequest.status == 200) { var srt = httpRequest.responseText; var lines = srt.split("\n"); var s = ""; var srtList = [] console.log(lines); for (var i = 0; i<lines.length; i+=4) { if (lines[i+2] == undefined) continue; if ((lines[i+2].substr(-2, 1) == '.' || lines[i+2].substr(-2, 1) == '!' || lines[i+2].substr(-2, 1) == '?') && (lines[i+6] == undefined || lines[i+6].substr(0, 1) != ' ')) { srtList.push(s + lines[i+2]); s = ""; } else s += lines[i+2]; } if (s != "") srtList.push(s); var div, newElement, new_div; div = document.getElementById('courseLearn-inner-box').children[0]; new_div = document.getElementById('srt_div'); if (new_div) { new_div.innerHTML = ""; } else { new_div = document.createElement('div') new_div.setAttribute("id", "srt_div"); } if (div) { for (i = 0; i<srtList.length; i++) { newElement = document.createElement('p'); newElement.innerHTML = srtList[i]; new_div.appendChild(newElement); } div.parentNode.insertBefore(new_div, div.nextSibling); } } }; } }, false); open.apply(this, arguments); }; })(XMLHttpRequest.prototype.open);
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址