Probleme beim Arbeiten mit Anfrage- und asynchronen NPMs, neu auch in JS.Async und Request, Ergebnisse zurückgeben
var queries = getURLS();
async.map(queries, function(url, callback) {
var options = {
url: url,
proxy: config.ProxuURL + ":" + config.ProxyPort,
headers: {
'SwitchProxy': location,
'User-Agent': getUA()
},
resolveWithFullResponse: true
};
request(options, function (err, res, body){
if (!err && res.statusCode === 200) {
var urls = [];
var $ = cheerio.load(body);
$('h3.r a').each(function(i) {
urls[i] = getDomain($(this).attr('href'));
});
//How do I return urls so I can access it outside of the async loop?
}
});
});
Wenn ich console.log (URLs) Ich erhalte 10 Arrays von Domain-Namen, möchte ich sie alle in einer Masterliste aggregieren, so kann ich durch sie analysieren.