Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the max number of tweets you can get from the Twitter "statuses/user_timeline" at once?

Tags:

twitter

You'd think this would be an obvious question that I wouldn't have to ask, but apparently I do because in the documentation for this they say two things that seem to be contradictory. First:

This method can only return up to 3,200 of a user's most recent statuses.

Second:

count: Specifies the number of tweets to try and retrieve, up to a maximum of 200.

So is it actually possible to get 3200 of a user's tweets? If so, how?

like image 907
Zelbinian Avatar asked Feb 09 '12 21:02

Zelbinian


1 Answers

The user_timeline itself contains up to 3,200 possible statuses.

By default, when you make a request to the user_timeline API it will give you 20 results per page. With the count parameter, you can ask for up to 200 results per page.

To retrieve all 3,200 statuses in a user_timeline, you'll need to paginate through each page of results. For 3,200 tweets at 200 tweets per page, that's 16 pages (and requests) to fetch all the results.

Keep in mind that the count parameter is really an "up to" parameter in the Twitter API -- you may sometimes get less results per page depending on a few circumstances. Be sure and use include_rts=true to include retweets in the result set for more consistent pagination.

like image 159
Taylor Singletary Avatar answered Oct 08 '22 16:10

Taylor Singletary