Skip to content

Commit

Permalink
Handles broken RSS feeds that may not include an <rss> declaration.
Browse files Browse the repository at this point in the history
An example feed is: http://stocknewsnow.com/feed/. The feed is a semi-valid
RSS feed, it's just missing the global <rss> declaration.
  • Loading branch information
kopertop committed Aug 25, 2016
1 parent f1fbcb1 commit 0146a96
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ FeedParser.prototype.handleOpenTag = function (node){
this.xhtml['#'] += '>';
} else if ( this.stack.length === 0 &&
(n['#name'] === 'rss' ||
(!this.meta['#type'] && n['#name'] === 'channel') ||
(n['#local'] === 'rdf' && utils.nslookup([n['#uri']], 'rdf')) ||
(n['#local'] === 'feed'&& utils.nslookup([n['#uri']], 'atom')) ) ) {
Object.keys(n['@']).forEach(function(name) {
Expand All @@ -189,6 +190,10 @@ FeedParser.prototype.handleOpenTag = function (node){
this.meta['#type'] = 'rss';
this.meta['#version'] = n['@']['version'];
break;
case 'channel':
this.meta['#type'] = 'rss';
this.meta['#version'] = n['@']['version'];
break;
case 'rdf':
this.meta['#type'] = 'rdf';
this.meta['#version'] = n['@']['version'] || '1.0';
Expand Down

0 comments on commit 0146a96

Please sign in to comment.