-
-
Save StErMi/4ad8696984f83f447da3 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
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