Loading RSS/Atom feeds in a browser with Feednami

Feednami is a tool that makes it easy to parse RSS/Atom feeds in a browser. It works by parsing the XML server-side and returning it as JSON. Anyone using Google Feed API today should consider using this as an alternative.

Import

To use Feednami, include this script in your site. Since the source is hosted on GitHub, you can use RawGit, but you may want to copy the source to wherever you host your other JavaScript.

<script src="https://cdn.rawgit.com/sekando/feednami-client/master/releases/1.0.2.min.js"></script>

Load a feed

Fetch your favorite blog or podcast!

<script>
  var url = 'https://devblog.ricky.me/rss.xml'
  feednami.load(url,function(result){
    if(result.error){
      console.log(result.error)
    }
    else{
      var entries = result.feed.entries
      for(var i = 0; i < entries.length; i++){
        var entry = entries[i]
        console.log(entry.title)
      }
    }
  })
</script>

For the former Google API users

feednami.loadGoogleFormat replicates as best as possible the Google Feed API. For example, the content attribute of an entry corresponsds to <content>, <summary>, or <description>, whereas by default, all three are returned with the unset values as null.

<script>
  var url = 'https://devblog.ricky.me/rss.xml'
  feednami.loadGoogleFormat(url,function(result){
    if(result.error){
      console.log(result.error)
    }
    else{
      var entries = result.feed.entries
      for(var i = 0; i < entries.length; i++){
        var entry = entries[i]
        console.log(entry.title)
        console.log(entry.contentSnippet) 
        // the first 120 characters of the entry
      }
    }
  })
</script>

Where you currently use new Feed(url).load(callback) with the Google Feed API, all you need to do is use feednami.loadGoogleFormat(url, callback)

Documentation and Examples

Full documentation of the how to load feeds and the structure of the response is available here.

There are also examples available in the repository on GitHub and the Sekando website