Skip to content

Instantly share code, notes, and snippets.

@scripting
Last active June 8, 2017 21:09
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scripting/823930d76b887b462ed6b2c8c4870073 to your computer and use it in GitHub Desktop.
Save scripting/823930d76b887b462ed6b2c8c4870073 to your computer and use it in GitHub Desktop.
An 8-line Node.js script to convert the XML version of Scripting News's feed to JSON.
const xml2js = require ("xml2js"), request = require ("request");
request ("http://scripting.com/rss.xml", function (error, response, data) {
if (!error && (response.statusCode == 200)) {
xml2js.parseString (data, function (err, result) {
console.log (JSON.stringify (result, undefined, 4));
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment