I want a scheduled job to run on heroku that pulls in data from an external RSS feed. I started out with libxmljs. Things looked promising until I deployed to heroku. In order to build my slug file libxmljs needs to have access to SCons:
-----> Installing dependencies with npm 1.0.94Shame!
> libxmljs@0.4.3 preinstall /tmp/build_16f6d4f95rt18/node_modules/easyrss/node_modules/libxmljs
> make node
make: scons: Command not found
make: *** [node] Error 127
npm ERR! error installing libxmljs@0.4.3 Error: libxmljs@0.4.3 preinstall: `make node`
npm ERR! error installing libxmljs@0.4.3 `sh "-c" "make node"` failed with 2
Easyrss looked good too but also had the same libxmljs dependency.
In the end I settled on xml2js which works just fine. Here's my code snippet:
var request = require('request'),
xml2js = require('xml2js'),
_ = require('underscore');
var parser = new xml2js.Parser();
request('http://url.to.my.rss.feed', function(error, response, body) {
if (!error && response.statusCode == 200) {
parser.parseString(body, function (err, result) {
_(result.item).each( function(item) {
console.log(item.title);
});
});
}
});I can exercise the script successfully via heroku run bash.


