1
votes

I'm trying to process tweets through twitter4j. As described here https://dev.twitter.com/docs/working-with-timelines, i have sent my first request with only parameter "count" to retrieve first 100 tweets according my criteria. The subsequent requests should have since_id parameter set with the latest tweet id i retrieved from previous call, so that it will return latest tweets after the given since_id. But what i understand here is, when we send since_id, if there are 200 new tweets are available after that id, the latest 100 will be returned, so i'm going to miss the 100 in between. How should i set the request parameters, so that i can retrieve X amount of tweets from the given since_id? I need to retrieve 100 tweets after the last retrieved tweet id from every call.

Thanks.

1

1 Answers

2
votes

You can retrieve it, check out https://dev.twitter.com/docs/api/1.1/get/statuses/user_timeline You have the max_id, since_id and count options that can help you out get the required result. Let's say the last tweet you got has an ID=X. Save the result somewhere so that next time you specify the since_id as X and you get all the tweets that have an ID greater than this one.