how we can retrive the tweets for user for specific time span (start date and end date)?

dheerajmittalsa
@dheerajmittalsa dheeraj mittal

how we can retrive the tweets for user for specific time span (start date and end date) ? Is there any seprate api ? or is there any seperate method/parameter for that?

2 years 1 week ago

Replies

episod
@episod Taylor Singletary

The answer to this question kind of varies user-to-user. A user_timeline can only go back up to 3,200 statuses. If the user posts frequently, that could be 2 weeks worth of tweets. If they post infrequently, that could be 2 years worth of tweets. See GET statuses/user_timeline for more information on this method.

There aren't any specific date range operators you can apply to this timeline, but because you can fetch up to 150-200 statuses per request, walking through an entire user's timeline will only take up to 16-20 API requests (or less if they have less tweets) to fetch their entire timeline. Then you could query against your now local dataset for the date ranges you're looking for.

2 years 1 week ago
bathybius
@bathybius Ryan

"150-200 statuses per request"
How did you arrive at this range? Is this in the docs?

2 years 1 week ago
episod
@episod Taylor Singletary

200 is the maximum you can request per page with that method. I gave a range, because you can more reliably (less likely to receive a timeout) make requests by lowering your count value.

2 years 1 week ago
bathybius
@bathybius Ryan

I now see the 200 count limit at https://dev.twitter.com/docs/api/1/get/statuses/user_timeline

The same page also says "This method can only return up to 3,200 of a user's most recent statuses." How to square that with the 200 count limit?

Is a "status" different than a tweet?

(The page also says "Returns the 20 most recent statuses posted by the authenticating user." But I assume that's the default if you don't set a count.)

ps -- I think I'm getting this now. I presume "statuses" includes re-tweets, but "tweets" is just the user's own tweets. Correct?

2 years 1 week ago
episod
@episod Taylor Singletary

You're totally on the right track.

The 3,200 limit is retrievable by paginating through the set, with the per page amount being by default 20, but allowable up to 200 at a time.

A status and a tweet are synonymous. Retweets are just a special kind of status/tweets, but are still considered "statuses."

2 years 1 week ago
rigoneri
@rigoneri Rigo

Is there any plans on the near future to allow get by date range? so we don't have to make about 15 requests per user to try to find a tweet on a specific date? I would think that would be preferable for you guys as well

1 year 50 weeks ago
koorzenb
@koorzenb Barend Koorzen

Any chance that one can subscribe to a feed, but only for limited time slots? That is, I want to follow local traffic tweets and start receiving them 30 minutes before I leave from work. I do NOT want to receive traffic reports for the whole day.
Thanx!

6 hours 20 min ago