views:

25352

answers:

10

I am looking for a jQuery solution to parse RSS feeds. I want something reusable and easy...

Know of a plugin? Or a way to do this with jQuery base?

+28  A: 

Use jFeed - a jQuery RSS/Atom plugin. According to the docs, it's as simple as:

jQuery.getFeed({
   url: 'rss.xml',
   success: function(feed) {
      alert(feed.title);
   }
});
Nathan Strutz
any examples of real world usage? ie parsing and displaying rather than alert. or is it as simple as $("#results").append(feed.title)
NOTE: the download has all kinds of great examples in it
good answer but i can't download this plugin how i can download it because tar.gz format is not supports by my winrar
Anirudha, perhaps you can try 7-zip? It's Free, open source, and opens a variety of file types, including tar/gzip.
Nathan Strutz
A: 

I found a few but have not tried any of them myself. The most promising looks like jFeed.

Seamus
+7  A: 
yogman
A good idea, but doesn't work when you're inside a firewall which requires proxy authentication using a dialogue box.
thewinchester
A: 

Should you decide to roll your own, you will find the specifications you require at the RSS Advisory Board

neonski
+10  A: 

Using JFeed

function getFeed(sender, uri) {
    jQuery.getFeed({
        url: 'proxy.php?url=' + uri,
        success: function(feed) {
            jQuery(sender).append('<h2>'
            + '<a href="'
            + feed.link
            + '">'
            + feed.title
            + '</a>'
            + '</h2>');

            var html = '';

            for(var i = 0; i < feed.items.length && i < 5; i++) {

                var item = feed.items[i];

                html += '<h3>'
                + '<a href="'
                + item.link
                + '">'
                + item.title
                + '</a>'
                + '</h3>';

                html += '<div class="updated">'
                + item.updated
                + '</div>';

                html += '<div>'
                + item.description
                + '</div>';
            }

            jQuery(sender).append(html);
        }    
    });
}

<div id="getanewbrowser">
  <script type="text/javascript">
    getFeed($("#getanewbrowser"), 'http://feeds.feedburner.com/getanewbrowser')
  </script>
</div>
A: 

We recently had to parse out XML from an RSS feed using purely jQuery - if you would like to take a look at some of our source code on how to get it done, feel free to download it from: http://blarnee.com/wp/myspace-blog-reader-widget-using-jquery-ajax-and-greybox/

A: 
<script type="text/javascript" src="./js/jquery/jquery.js"></script>
<script type="text/javascript" src="./js/jFeed/build/dist/jquery.jfeed.pack.js"></script>
<script type="text/javascript">
    function loadFeed(){
        $.getFeed({
            url: 'url=http://sports.espn.go.com/espn/rss/news/',
            success: function(feed) {

                //Title
                $('#result').append('<h2><a href="' + feed.link + '">' + feed.title + '</a>' + '</h2>');

                //Unordered List
                var html = '<ul>';

                $(feed.items).each(function(){
                    var $item = $(this);

                    //trace( $item.attr("link") );
                    html += '<li>' +
                        '<h3><a href ="' + $item.attr("link") + '" target="_new">' +
                        $item.attr("title") + '</a></h3> ' +
                        '<p>' + $item.attr("description") + '</p>' +
                        // '<p>' + $item.attr("c:date") + '</p>' +
                        '</li>';
                });

                html += '</ul>';

                $('#result').append(html);
            }
        });
    }
</script>
kabuski
Not a bad answer, but unfortunately you didn't do the greatest job pasting the code. ;-)
Till
+1  A: 

I'm using jquery with yql for feed. You can retrieve twitter,rss,buzz with yql. I read from http://tutorialzine.com/2010/02/feed-widget-jquery-css-yql/ . It's very useful for me.

saturngod
+1  A: 

jFeed is somewhat obsolete, working only with older versions of jQuery. It has been two years since it was updated.

zRSSFeed is perhaps a little less flexible, but it is easy to use, and it works with the current version of jQuery (currently 1.4). http://www.zazar.net/developers/zrssfeed/

Here's a quick example from the zRSSFeed docs:

<div id="test"><div>

<script type="text/javascript">
$(document).ready(function () {
  $('#test').rssfeed('http://feeds.reuters.com/reuters/oddlyEnoughNews', {
    limit: 5
  });
});
</script>
Alderete
+5  A: 

jFeed doesn't work in IE.

Use zRSSFeed. Had it working in 5 minutes

FutureKode
Available at http://www.zazar.net/developers/zrssfeed/About to try it out myself to see how it goes, looks promising.
thewinchester