apiresttwitterrtweet

How to retrieve old tweets (beyond the most recent 3,200 tweets) from a specific user account on Twitter?


I have access to the Academic Research API. I am trying to retrieve old tweets from political candidates’ accounts during certain election campaigns (i.e., I would ideally specify begin and end dates). The timeline endpoint allows me to retrieve only the last 3,200 tweets of each of these accounts; but this falls short, since I cannot get any tweets from the desired election campaign period because it is too old in the timeline. I would ideally like to retrieve 3,200 tweets from a certain end date (the end of the election campaign). I have also seen the option of a Full archive endpoint, which would allow me to retrieve old tweets, but this does not directly enable (correct me if I am wrong) the targeting of specific users. Is there any additional option you would recommend to deal with this? Or would you rather directly retrieve each of the tweets using the IDs (although this would be too manual)?


Solution

  • Apparently the best way to do this is to use the Archive Search API. It is part of the premium API, so you first need to be granted an application with connection to the Academic Research API, and then opening a premium environment that lets you access the Archive Search API.

    Once in the Archive Search API, you can specify dates (they are parameters of the request) and specific users with parameters within the query. An example here with twarc2 (Python): https://twittercommunity.com/t/twitter-api-timeline/171849/4?u=aguperonodo

    In rtweet, this functionality can be implemented with the search_fullarchive function.