Twitter API with OAuth2 using R
Posted by omegahat on October 13, 2014
I just put together some code to collect tweets from Twitter’s search API for some students at Davis. A brief document describing the approach and the code itself is available at https://github.com/duncantl/TwitterOAuth2.git. It is not completely robust, but it does illustrate how to
- use OAuth2 for the application-only authentication,
- deal with rate-limiting, and
- cursor through the result set of a single query.
The OAuth2 approach gives us a higher rate-limit. There is also code to use the OAuth1.1 mechanism by directly signing the request using the ROAuth package. This is quite simple using the ROAuth:::signRequest() function.
I am not the first to do this and other people have posted aspects of this at various places. This tries to show all the pieces.