Skip to content

Commit 0146a96

Browse files
committed
Handles broken RSS feeds that may not include an <rss> declaration.
An example feed is: http://stocknewsnow.com/feed/. The feed is a semi-valid RSS feed, it's just missing the global <rss> declaration.
1 parent f1fbcb1 commit 0146a96

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

main.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ FeedParser.prototype.handleOpenTag = function (node){
175175
this.xhtml['#'] += '>';
176176
} else if ( this.stack.length === 0 &&
177177
(n['#name'] === 'rss' ||
178+
(!this.meta['#type'] && n['#name'] === 'channel') ||
178179
(n['#local'] === 'rdf' && utils.nslookup([n['#uri']], 'rdf')) ||
179180
(n['#local'] === 'feed'&& utils.nslookup([n['#uri']], 'atom')) ) ) {
180181
Object.keys(n['@']).forEach(function(name) {
@@ -189,6 +190,10 @@ FeedParser.prototype.handleOpenTag = function (node){
189190
this.meta['#type'] = 'rss';
190191
this.meta['#version'] = n['@']['version'];
191192
break;
193+
case 'channel':
194+
this.meta['#type'] = 'rss';
195+
this.meta['#version'] = n['@']['version'];
196+
break;
192197
case 'rdf':
193198
this.meta['#type'] = 'rdf';
194199
this.meta['#version'] = n['@']['version'] || '1.0';

0 commit comments

Comments
 (0)