I am trying to use the twitter API to get search results and then modify them, before displaying them on the page.
I am new to the idea of Asynchronous functions and I dont see how to run this method for several search strings and work on the results:
var results = [];
for (string in searches) {
client.get('search/tweets', {q: searches[string]}, function(error, tweets, response){
console.log(tweets); // I need to put these in an array (results) and get the next lot
});
}
analyse(results);
I need to run search/tweets several times and build up an array of the results so they can be analysed. I dont know how to do this if I have to work in the function? Putting it into a callback function would have the same problem.