阅读Feed,如何从中获取详细信息

时间:2013-11-05 08:38:15

标签: jquery rss

我正在使用http://www.zazar.net/developers/jquery/zrssfeed/

中的工具从feeds.feedburner.com上阅读Feed

我的要求是从feeds.feedburner.com读取一个Feed并获取其标题,内容,然后使用这两个参数使用rest API在我的网站上发布一个帖子。目前,我无法使用http://www.zazar.net/developers/jquery/zrssfeed/上的插件获取Feed的标题和内容。

我的代码如下:

$(document).ready(function () {
    $('#test').rssfeed('http://feeds.feedburner.com/thesartorialist',{},function(e) {
        $('h4 a',e).each(function(i) {
            var title = $(this).text();
            if (title.length > 14)

            $(this).text(title);

        });
    });
});

zazar.net使用了代码片段,如果我能够获取标题和内容,它就满足了我的要求,因为我需要将其传递给REST API。

如果我需要提供更多详细信息,请告诉我。

提前致谢

1 个答案:

答案 0 :(得分:0)

我检查了zazar.net的基本用法 您可以使用该内容绑定内容。

$(document).ready(function () {
    $('#test').rssfeed('http://feeds.reuters.com/reuters/oddlyEnoughNews');
});

然后使用jquery遍历内容以获取详细信息。

var a2 = [];
var a1 = {"title":"", "content":""};

$("#test .rssBody ul li").each(function(){ 
var b = a1;
b.title = $(this).find("h4 a").html(); 
b.content= $(this).find("p").html();
a2.push(b);
});