I'm currently working on a project and have some questions regarding javascript / nodejs / request / cheerio .
request(address , function (error, response, html) {
if (!error && response.statusCode == 200) {
var $ = cheerio.load(html);
$('iframe').each(function(i, element){
var a = $(this).attr('src');
});
} });
So I'm having above code scraping precisely the data I want from some websites. I want it to render it in some template later. However it seems like var a lives only in the above piece of code, and there's no way to make it global (wouldn't mind it) or somehow return it. Any ideas?