javascript - Tampermonkey get downloaded resource -


so, web page @ load download json file. want @ content of json, possible?

i tried alter xmlhttprequest.prototype.open catch thing, seems script run after downloaded, nothing.

by download, mean on network tab of developer tools, there's row saying "abc.json?blablah".

note: file downloaded creating script element , attach body, destroy afterward (or something, because can't find after that).

// ==userscript== // @name         download subtitle wistia // @namespace    http://tampermonkey.net/ // @version      0.1 // @description  try take on world! // @author       // @match        http://*/* // @grant        none // @run-at       document-start // ==/userscript==  (function() {     'use strict';      var open = xmlhttprequest.prototype.open;     xmlhttprequest.prototype.open = function(method, url, async, user, pass) {         console.log("generic request: " + url);         if (url.indexof(".json") > -1) {             console.log("json request");             this.addeventlistener("readystatechange", function() {                 if (this.readystate === 4 && this.status == 200) {                     // parse content                     var data = json.parse(this.responsetext);                     console.log("huh coming");                     console.log(data);                 }             }, false);         }          open.call(this, method, url, async, user, pass);     }; })(); 


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -