Answer the question
In order to leave comments, you need to log in
How to set up a proxy server for localhost?
So, there is a server on node js, a middleware that sends data to the client
var taskpath = __dirname + '\\public\\task.json';
console.log(taskpath);
app.post('/task', function(req, res){
var readable = fs.createReadStream(taskpath);
readable.pipe(res);
});
GM_xmlhttpRequest({
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
url: 'http://localhost:8080/task',
onload: function(data) {
var json_text = JSON.stringify(data.response, null, 2),
your_object = JSON.parse(json_text);
var href = $('#guide-channels').find('li:contains(' + your_object[0].task[0].channel + ')').find('a').attr('href'),
videos = 'http://www.youtube.com' + href + '/videos',
channel = {};
channel['channel'] = videos;
/*GM_xmlhttpRequest({
method: 'POST',
data: JSON.stringify(channel),
contentType: 'application/json',
url: 'http://localhost:8081/getHttp',
onload: function (xhr) {
console.log('xhr__', xhr.responseText);
}
});*/
}
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question