In this repository you can check out some examples of how to capture Twitter data using the REST and Streaming API:
-
REST API. Return any authorized tweets which match the search criteria. This search API searches against a sampling of recent Tweets published in the past 7 days. You can use the
searchTwitter()
andsearch_tweets()
functions from the twitterR and rtweet packages, respectively. -
Streaming API. Opens a connection to Twitter’s Streaming API that will return public statuses that match one or more filter predicates. In other words, with this API you can capture Tweets in real time. Tweets can be filtered by keywords, users, language, and location. You can use the
filterStream()
andstreamtweets()
functions from the streamR and rtweet packages, respectively.
Using the rtweet package we can capture Twitter data more easily than with the other two. In fact, using this package it’s no longer necessary to obtain a developer account and create your own Twitter application. All you need is a Twitter account!