Google API for fetching RSS feeds

Google API for fetching RSS feeds

Google has provided simplest and easiest feeds API. Using Google Feed API, you can easily fetch feeds from a URL using only Javascript. You just need to customize the data fetched by this API.

Here is the link where you can get complete documentation of Google Feed API:
https://developers.google.com/feed/v1/devguide

<html>
  <head>

// You need to include this javascript file on your page to get the API to work
    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">

    google.load("feeds", "1");

// this function loads the feeds from the given URL
    function initialize() {
      var feed = new google.feeds.Feed("http://fastpshb.appspot.com/feed/1/fastpshb");
      feed.load(function(result) {
        if (!result.error) {
          var container = document.getElementById("feed");
          for (var i = 0; i < result.feed.entries.length; i++) {
            var entry = result.feed.entries[i];
            var div = document.createElement("div");
            div.appendChild(document.createTextNode(entry.title));
            container.appendChild(div);
          }
        }
      });
    }

// Calling the initialize function on your page load
    google.setOnLoadCallback(initialize);

    </script>
  </head>
  <body>

    <div id="feed"></div>
  </body>
</html>

Browser compatibility:
The Google Feed API supports Firefox 1.5+, IE6+, Safari, Opera 9+, and Chrome.

Return Format:

This API returns result in two basic formats. One is JSON, and other is XML. There is third format, which is MIXED.

The Google Feed API provides feed results in very well structured format, that we can use the attributes of the result set in the way we like to use. It provides feed time, feed title, feed content, feed image and other parts of the feed.

Google Feed API also provides specific methods for this API.
I am providing list of these methods here:

  • Setting the number of feed entries
  • This sets the number of entries to be fetched from given public RSS Feed

  • Setting the feed format
  • This sets the feed result format

  • Loading historical entries
  • This returns feed entries stored by Google that are no longer in the feed XML.

  • Returning nodes by element ID
  • This returns a NodeList of all the elements with a given local name and namespace URI.

  • Matching feeds to a query
  • google.feeds.findFeeds(query, callback) is a global method that returns a list of feeds that match the given query

So, it is super simple to use the API in your website, web page, application or blog for showing feeds from the blogs you like the most.
Just dig into the API, and google will do the rest itself.

Please write us if you need additional help.

Leave a Reply

avatar
  Subscribe  
Notify of
shares