I would like to programmatically access to specific URL content (MyURL/more_videos).
While using the Web Inspector from Safari, I noticed the data I want is in an XHRs folder. After googling about XHR, I tried some code with node.js but without any success.
Here is what I found at https://stackoverflow.com/a/32860099/8726869 :
function readBody(xhr) {
var data;
if (!xhr.responseType || xhr.responseType === "text") {
data = xhr.responseText;
} else if (xhr.responseType === "document") {
data = xhr.responseXML;
} else {
data = xhr.response;
}
return data;
}
var XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (xhr.readyState == 4) {
console.log(readBody(xhr));
}
}
xhr.open('GET', ‘MyURL/more_videos', true);
xhr.send(null);
Nevertheless, I didn't get anything the console neither error nor response.
I have attached some screen shots of the web inspector: