Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

node v0.10.0 issue with url parse #54

Closed
vseledkin opened this Issue Mar 22, 2013 · 1 comment

Comments

2 participants

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

Owner

danmactough commented Mar 23, 2013

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment