Search code examples
resttwittertweetstwitter-rest-api

How to get more than 100 retweets of the specific tweet?


I use Twitter REST API. Is there any way to get more than 100 retweets of the specific tweet? The default methods may return only 100 retweets.


Solution

  • Ok. GET statuses/retweets/:id does not allow pagination, indeed.

    You could consider getting the retweets indirectly, in the following way:

    • You do a GET search/tweets making sure that you include in the query some keywords of the tweet for which you want to get the retweets

    • You filter the output in order to find your tweet

    However, you are going to find quite a few problems:

    • Depending on the content of your tweet, it might be difficult to find it with this method. In any case, you'll have to paginate and to use the max_id parameter, as explained here

    • If you have to paginate a lot or if you have a big number of tweets that you need to know the number of retweets, you will face twitter rate limits. For how many tweets you want to do this? You will need to take into account that you will only be able to do 180/450 per 15 minutes (depending on the type of authentication)

    • And finally twitter does not guarantee that you are going to get all tweets, in particular if they are old (where old could even mean "older than a week"). So it might be you don't find more than 100 retweets just because the api is not providing the ones you are interested in

    In conclusion: I'm not sure it is worth it! Instead, when you collect your tweets, you would need to make sure that you get the retweets as well (or for that matter, any other parameter you need). When you collect tweets, you do it either with the REST api or the Streaming api and you can get it from there.

    Hope it helps.