Created
January 24, 2014 20:14
-
-
Save jdsiddon/8605379 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
getFiltersOnPage: function(urlArray, callback) { | |
var arrayOfFilters = []; | |
console.log(urlArray); | |
(itr = function() { | |
if (urlArray.length > 0) { | |
var temp = urlArray.pop(); | |
request(temp.Url, function(err, resp, body) { | |
"use strict"; | |
if (err) { | |
return console.log("ERR! " + JSON.stringify(err)); | |
} | |
var $ = cheerio.load(body); | |
$("div.searchcontent ul li").each(function(t, item) { | |
filterArray.push($(this).text()); | |
}); | |
console.log(filterArray); | |
}); | |
// arrayOfFilters.push(filterArray); | |
itr(); | |
} else { | |
callback(arrayOfFilters); | |
} | |
})(); | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment