Skip to content

Instantly share code, notes, and snippets.

@StErMi
Created January 19, 2013 10:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save StErMi/4ad8696984f83f447da3 to your computer and use it in GitHub Desktop.
Save StErMi/4ad8696984f83f447da3 to your computer and use it in GitHub Desktop.
for(var index = 0; index < results.length; index++) {
var apod = results[index];
console.log('Loaded podcast ' + apod.track_name);
//Update each feeds
var options = {
uri: apod.feed_url,
method: 'GET',
headers: {
'Content-Type': 'application/rss+xml'
}
};
request(options, function(error, response, body) {
inserted++;
if(!error && response.statusCode == 200) {
console.log('Parsing feed -> ' + apod.feed_url );
parseFeedXML(body, collection, apod);
} else {
//Errore, skippiamo
}
if(inserted >= results.length) {
console.log('Just updated/inserted ' + inserted + ' feeds');
apiResponse(res, getResponseMessageJSON(200, 'Just updated/inserted ' + inserted + ' feeds', ''));
return next();
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment