Node.jsでRSSを処理するの何がいいのかなーと色々試していた。その中で一番考えなくて済みそうなのがxml2jsだった。XMLをparseString()に渡すと、コールバックの引数にオブジェクトに変換して渡してくれる。 このウェブサイトのフィードをパースして標準出力に吐くならこんな感じで簡単。 var http = require('http'); var parseXML = require('xml2js').parseString; http.get('http://hail2u.net/feed', function (res) { var chunks = ''; res.setEncoding = 'UTF-8'; res.on('data', function (chunk) { chunks += chunk; }); res.on('end', function (
![Node.jsパッケージ: xml2js](https://cdn-ak-scissors.b.st-hatena.com/image/square/f2fda417d491d805f79065104db5f50e11015215/height=288;version=1;width=512/https%3A%2F%2Fhail2u.net%2Fapple-touch-icon-precomposed.png)