Trying to intercept request to get response data in a Greasemonkey script, I successfully get the response, but the actual page (any skill page on duolingo.com) just keeps loading forever as if waiting for something to happen. Is something missing in the script?
(function(send, open) {
'use strict';
XMLHttpRequest.prototype.send = async function(body) {
if (this.url.endsWith("sessions")) {
this.onreadystatechange = async function() {
if(this.readyState === 4) {
const response = JSON.parse(this.response);
console.log(response);
// LOADING...
}
}
};
send.apply(this, [body]);
};
XMLHttpRequest.prototype.open = function(method, url) {
this.url = url;
open.apply(this, arguments);
};
})(XMLHttpRequest.prototype.send, XMLHttpRequest.prototype.open);