我需要从单个 Twitter 帐户流式传输推文,但我不确定我做错了什么。使用“跟踪”时,流工作正常(流式传输趋势主题)。但是当我使用“跟随”时,代码会中断。
我正在使用 ntwitter 模块。
这是代码:
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);
});
});
我收到这个错误
Error: Uncaught, unspecified 'error' event.
at EventEmitter.emit (events.js:68:15)
at ClientRequest.Twitter.stream (F:\Dropbox\work\socketio\node_modules\ntwitter\lib\twitter.js:251:14)
at ClientRequest.EventEmitter.emit (events.js:88:17)
at HTTPParser.parserOnIncomingClient [as onIncoming] (http.js:1455:7)
at HTTPParser.parserOnHeadersComplete [as onHeadersComplete] (http.js:111:23)
at CleartextStream.socketOnData [as ondata] (http.js:1366:20)
at CleartextStream.CryptoStream._push (tls.js:492:27)
at SecurePair.cycle (tls.js:846:20)
at EncryptedStream.CryptoStream.write (tls.js:227:13)
at Socket.ondata (stream.js:38:26)