// ==UserScript== // @name 中国大学mooc数据劫持高清 // @namespace http://tampermonkey.net/ // @version 0.1 // @description try to take over the world! // @author You // @match https://www.icourse163.org/learn/* // @icon https://www.google.com/s2/favicons?domain=undefined. // @grant none // ==/UserScript== var oldxhr=window.XMLHttpRequest function newobj(){} window.XMLHttpRequest=function(){ let tagetobk=new newobj(); tagetobk.oldxhr=new oldxhr(); let handle={ get: function(target, prop, receiver) { if(prop==='oldxhr'){ return Reflect.get(target,prop); } if(typeof Reflect.get(target.oldxhr,prop)==='function') { if(Reflect.get(target.oldxhr,prop+'proxy')===undefined) { target.oldxhr[prop+'proxy']=new Proxy(Reflect.get(target.oldxhr,prop), { apply: function(target, thisArg, argumentsList) { return Reflect.apply(target, thisArg.oldxhr, argumentsList); } }); } return Reflect.get(target.oldxhr,prop+'proxy') } if(prop.indexOf('response')!==-1) { let result=Reflect.get(target.oldxhr,prop) if(target.oldxhr.responseURL.indexOf('/v1/vod/video?videoId=')!==-1&&result.indexOf!==undefined&&result.indexOf('videoUrl')!==-1&&result.indexOf('quality')!==-1){ let jstext=JSON.parse(result) if(jstext.result!==undefined&&jstext.result.videos!==undefined){ let fucktext=[] let main={ url:'', quality:-999 } for(let index=0;indexmain.quality){ main.quality=item.quality main.url=item.videoUrl } } console.log('main',main) for(let index=0;index