result.entries[i].url is returning empty string when tried to read actual URL of rss feeds using google rss feed api

22 views
Skip to first unread message

Aasif Iqbal

unread,
Mar 10, 2015, 7:43:51 AM3/10/15
to google-ajax...@googlegroups.com

Hello Guys,

Hope you are doing well.

I am using google api for fetching rss feeds.I am getting list of feeds properly,but problem is that when I tried to read the actual feed url it is retruning as undefine/empty string.My code looks like :

<html>
  <head>
    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">

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

    function OnLoad() {
      // Query for president feeds on cnn.com
      var query = 'site:cnn.com president';
      google.feeds.findFeeds(query, findDone);
    }

    function findDone(result) {
      // Make sure we didn't get an error.
      if (!result.error) {
        // Get content div
        var content = document.getElementById('feed');
        var html = '';

        // Loop through the results and print out the title of the feed and link to
        // the url.
        for (var i = 0; i < result.entries.length; i++) {
          var entry = result.entries[i];
          html += '<p><a href="/feed/v1/' + entry.url + '">' + entry.link + '</a></p>';
        }
        content.innerHTML = html;
      }
    }

    google.setOnLoadCallback(OnLoad);

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


It seems that "entry.url" method is not returning any value.Please update me if there are any changes in API or I am doing something wrong?

--------
Thanks in advance.
Aasif Iqbal
Reply all
Reply to author
Forward
0 new messages