danmactough / node-feedparser

Robust RSS, Atom, and RDF feed parsing in Node.js
Other
1.97k stars 192 forks source link

node v0.10.0 issue with url parse #54

Closed vseledkin closed 11 years ago

vseledkin commented 11 years ago

try the code below

var parser = require('feedparser'); var url = 'http://com-stol.ru/?feed=rss2'; parser.parseUrl( url,
{ addmeta: false, feedurl: true }, function(e, meta, articles){ console.log('got % articles from %s feed',articles.length, url); } );

results:

url.js:118 throw new TypeError("Parameter 'url' must be a string, not " + typeof url) ^ TypeError: Parameter 'url' must be a string, not boolean at Url.parse (url.js:118:11) at urlParse (url.js:112:5) at Object.urlResolve as resolve at Object.resolve (/Users/vseledkin/WORK/feedstore/node_modules/feedparser/utils.js:111:14) at FeedParser. (/Users/vseledkin/WORK/feedstore/node_modules/feedparser/main.js:388:26) at Array.forEach (native) at FeedParser.handleAttributes (/Users/vseledkin/WORK/feedstore/node_modules/feedparser/main.js:370:22) at FeedParser.handleOpenTag (/Users/vseledkin/WORK/feedstore/node_modules/feedparser/main.js:170:19) at SAXStream.EventEmitter.emit (events.js:95:17)

I assume that there is something with URL API changes in node v0.10.0

danmactough commented 11 years ago

Two things:

  1. You're right that node v0.10.x is acting differently, but
  2. You're passing an invalid value as the feedurl option. That must be a String, not a Boolean, and that's what's actually causing the error.

If you need to supply the feedurl (which you shouldn't when you're using parseUrl), then make sure to use the actual feed, not true.