node.js获取RSS返回json

安装依赖包

npm install rsj

示例

rsj = require('rsj');//RSS as JSON when use it we must (npm install rsj) first
rsj.r2j('http://news.ifeng.com/pubres/rss/opinion/phjd/feed.xml',function(json) {
    var obj = eval('(' + json + ')');//js原生方法
    //var obj = JSON.parse(json);//json.js包
    res.render('index', { title: 'testbook',layout:'layout',nav:'index',rssData:obj});
});

转载自:http://www.9958.pw/post/nodejs_rss_json

rss

相关推荐