0
votes

I am attempting to parse this rss feed - http://www.spiegel.de/international/germany/index.rss

I am using the following code to parse it:

 $.ajax({
        url      : document.location.protocol + '//ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=10&callback=?&q=' +
        encodeURIComponent('http://www.spiegel.de/international/germany/index.rss'),
        dataType : 'json',
        success  : function (data) {
          if (data.responseData.feed && data.responseData.feed.entries) {
            $.each(data.responseData.feed.entries, function (i, e) {
              console.log("------------------------");
              console.log("title      : " + e.title);
              console.log("link      : " + e.link);
              console.log("pubDate     : " + e.pubDate);
              console.log("description     : " + e.description);
              console.log("pubDate     : " + e.pubDate);
              console.log("guid: " + e.guid);
            });
          }
        }
      });

In the console.log only the title and the link appear. The description, pubDate and guid are all undefined.

Could someone be so kind as to explain what I am doing wrong?

1

1 Answers

0
votes

You can check the whole "schema" of the response given by Google using this gist.

You'll see that each entry has the following items:

  • title
  • link
  • author
  • publishedDate
  • contentSnippet
  • content
  • categories

So, unfortuately for you the guid is missing. You'll have to use content (or contentSnippet) instead of description and publishedDate instead of pubDate. If you really need the guidcheck out the alternative offred by Superfeedr (I created Superfeedr!).