twit
twit copied to clipboard
Streams do not work
I have this code, that is supposed to stream whatever Elon Musk is posting:
const twitter = new Twit({`consumer and access tokens provided`});
var stream = twitter.stream('statuses/filter', { track: '@elonmusk' });
stream.on('tweet', (tweet) => {
console.log(tweet);
});
stream.on('error', (error) => {
console.error(error);
});
But, whenever I run it, I get
Error: Bad Twitter streaming request: 404
at exports.makeTwitError (Documents/nCommBot/nCommentTwitter/node_modules/twit/lib/helpers.js:74:13)
at Request.<anonymous> (Documents/nCommBot/nCommentTwitter/node_modules/twit/lib/streaming-api-connection.js:96:29)
at Request.emit (node:events:525:35)
at IncomingMessage.<anonymous> (/Documents/nCommBot/nCommentTwitter/node_modules/request/request.js:1076:12)
at Object.onceWrapper (node:events:627:28)
at IncomingMessage.emit (node:events:525:35)
at endReadableNT (node:internal/streams/readable:1359:12)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
code: null,
allErrors: [],
twitterReply: '',
statusCode: 404
}
Honestly, I have no idea what is wrong with this noe....
March 14, 2023 Twitter API v1.1
Today, we are deprecating the statuses/filter endpoint in the Twitter API v1.1 Developers can use the filtered stream endpoint in the Twitter API v2.
last commit was 2018, this hasnt been updated since 2018