Twitter API gets tweets after id

I am trying to process tweets via twitter4j. As described here https://dev.twitter.com/docs/working-with-timelines, I sent my first request with only the "count" parameter to get the first 100 tweets according to my criteria. In subsequent requests, the from_id parameter must be set with the last tweeter identifier i obtained from the previous call, so that it will return the last tweets after the specified from_id parameter. But what I understand here is when we send from_id, if 200 new tweets are available after this identifier, the last 100 will be returned, so I will skip 100 between them. How do I set request parameters so that I can get the X number of tweets from the given from_id parameter? I need to get 100 tweets after the last tweet id retrieved from each call.

Thank.

0
source share
1 answer

You can get it, check https://dev.twitter.com/docs/api/1.1/get/statuses/user_timeline You have max_id, from_id and count parameters that can help you get the desired result. Say the last tweet you received has ID = X. Save the result somewhere so that the next time you specify from_id as X, and you get all the tweets with an identifier greater than this.

+1
source

Source: https://habr.com/ru/post/1648591/


All Articles