Get a tweet by ID in JavaScript with twit?

Viewed 1370

I'm using twit in Node to stream tweets, and I want to use setTimeout to grab each tweet 5 minutes after it's posted (to see how many likes it's gotten in those 5 minutes.

I have the streaming and timeout working fine, but now I need to re-fetch the status from Twitter to get the updated like count. So within the timeout I'll do:

T.get('statuses/show/:id', { id: statusId }, function(err, data, response) {
  console.log('test err     : ' + err )
  console.log('test data    : ' + data
  console.log('test response: ' + response )
})

where statusId is the ID from the streamed tweet. This fails, because Twitter ID's are 18-digit numbers, which JavaScript rounds! I have the ID as a string, but the Twitter API point wants a number. Is there a way to do this?

0 Answers
Related