node.js - Can not use "follow" in the streaming api in ntwitter. Recieving Unspecified 'error' event -


i need stream tweets single twitter account i'm not sure i'm doing wrong. when using 'track' stream works fine (streaming trending topics). when use 'follow' code breaks.

i'm using ntwitter module.

this code:

var twitter = require('ntwitter');  var twit = new twitter({   consumer_key: 'deleted',   consumer_secret: 'deleted',   access_token_key: 'deleted',   access_token_secret: 'deleted' });   twit.stream('statuses/filter', { follow:'@tbottt' }, function(stream) {     stream.on('data',function(data){       console.log(data);     }); }); 

i error

error: uncaught, unspecified 'error' event.     @ eventemitter.emit (events.js:68:15)     @ clientrequest.twitter.stream (f:\dropbox\work\socketio\node_modules\ntwitter\lib\twitter.js:251:14)     @ clientrequest.eventemitter.emit (events.js:88:17)     @ httpparser.parseronincomingclient [as onincoming] (http.js:1455:7)     @ httpparser.parseronheaderscomplete [as onheaderscomplete] (http.js:111:23)     @ cleartextstream.socketondata [as ondata] (http.js:1366:20)     @ cleartextstream.cryptostream._push (tls.js:492:27)     @ securepair.cycle (tls.js:846:20)     @ encryptedstream.cryptostream.write (tls.js:227:13)     @ socket.ondata (stream.js:38:26) 

a little late know, found question after having same problem myself.

i discovered must use twitter user's id , not screen name, in follow request.

there few websites claim offer quick twitter username -> id search, none of them worked me. instead, found if view source code on page containing tweet user , search data-user-id, find listed attribute in html element (usually second or third occurance of contains id).

hope helps someone.


Comments