I am new in node.js and javascript. I want to scraping the website and handle the html sources. so I found the way to tracking way, Like this.
var request = require('request');
var aaaa ="";
request('http://www.google.com', function (error, response, body) {
if (!error && response.statusCode == 200) {
aaaa = body;
}
});
console.log(aaaa);
I can show the google's html source, like this
request('http://www.google.com', function (error, response, body) {
if (!error && response.statusCode == 200) {
console.log(body);
}
});
but to do so, I can't handle the google's html source any more, so my intention is getting out the the body as aaaa .
How can I make it? other way to making same purpose?