Get the latest tweet of a set of users in streaming api


#1

Can I use the “follow” parameter in streaming api? Given an user id, I want to get the latest tweet of this user, and the latest tweet could be before I start the streaming api connection.

For example, I start the connection in 11:00am, can I get the tweet in 10:00am of an user?


#2

The /1.1/users/show or /1.1/users/lookup API endpoints will give you this. In the response, there’s a status object inside each user object, which is the user’s most recent tweet.


#3

The rest API only allow 100 users per request. If I want to access a large number of user’s latest tweet. What is the best way to do it?

The streaming api has 5000 user limit, and I can see that it returns some past tweets before my connection time.


#4

The default limit on /1.1/users/lookup is 180 calls per 15 minutes. That’s 72,000 lookups per hour.


#5

You mean that I can get 72,000 tweets per hour?

180×100×4=72,000

So the most efficient way is to call users/lookup one by one, and each call passes 100 users id. Right?


#6

If I had a bunch of user IDs, and wanted to get the most recent tweet for each, that’s what I would do.


#7

I’d like to collect the previous N tweets from a very large number of users (10s of thousands).

Using this method (i.e. /1.1/users/lookup) is there a way to get N previous tweets, or does it only return the most current tweet/status?

Ideally, I would like to set up a Stream, and receive ongoing status updates for many thousand users, but given the rate limits, that doesn’t seem possible…

I hope I’m mistaken!