andris9/NodePie

Problem with getDescription for Blogger

Closed this issue · 1 comments

If I use it with blogger and my rss are short. This url, for example:
http://sportaxy.blogspot.com/feeds/posts/default?alt=rss

It does not find the description for item.getDescription()

In line 767, you have this.element.summary. But in reality
this.element["atom:summary"] contains the summary.

{ guid: 
   { isPermaLink: 'false',
     '$t': 'tag:blogger.com,1999:blog-4551109458762950627.post-8721511360192482375' },
  pubDate: 'Sun, 06 Jun 2010 09:20:00 +0000',
  'atom:updated': '2010-06-06T02:24:20.240-07:00',
  title: 'Account for Competitions organizators + extended user profile',
  'atom:summary': 
   { type: 'text',
     '$t': 'The competitions organizators can create now a special account where they can register their competitions (not done yet!). When user creates an account he can choose if he is a general user or a race/competition organizator.Also for both general user and organizator there is an extended user profile where user can specify birth date, contact info, name, etc.' },
  link: 'http://sportaxy.blogspot.com/2010/06/account-for-competitions-organizators.html',
  author: 'noreply@blogger.com (Train&Race)',
  'thr:total': '0' }

So I had to define new variable for my purposes. Maybe you also want to fix it in a better way.

var summary = this.element['atom:summary'];
return this._parseContents(
    this.element.description || summary || 
    this.element.content || (cns && this.element[cns+":encoded"]) || ""
);

Hi, could you do a pull request for this patch?

Do not use hardcoded namespaces but variables instead. For example "atom:summary" should be replaced with

var atom10ns = this.namespaces[NodePie.NS.ATOM10];
var summary = this.element[atom10ns + ":summary"];

This is needed if a feed implementation decides to use something else (rarely happens but is totally valid)