node.js獲取RSS返回json

安裝依賴包node

npm install rsj

示例npm

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_jsonjson

相關文章
相關標籤/搜索