Description Usage Arguments Details
View source: R/search-tweets.R
search_and_store_tweets
allows to execute long-running Tweet searches
against the
/2/tweets/search/all
endpoint in the Twitter Academic Research product track
Twitter
Academic Research product track and store the results as batches of files
containing the original JSON responses.
1 2 3 |
queryString |
a character string specifying a value for the Tweet search query parameter (e.g. "sustainability (climate change)", "from:stefandaume" etc). See here for details. Maximum of 1024 characters. |
fromDate |
a character string of format ("YYYY-MM-DD") specifying the
date for the oldest Tweets to be included in the search results
(interpreted as inclusive); corresponds to the |
toDate |
a character string of format ("YYYY-MM-DD") specifying the date
for the most recent Tweets to be included in the search results
(interpreted as inclusive); corresponds to the |
batchBaseLabel |
a character string used to name the stored Tweet search batch files. |
maxBatchSize |
an integer specifying the approximate number of Tweets in
each stored batch of Tweet search responses. This number serves as a
threshold, once more Tweets than |
twitterBearerToken |
a character string specifying a valid bearer token
for the
Twitter
Academic Research product track (see |
verbose |
a boolean indicating whether more detailed intermediate progress messages should be printed to the console; if FALSE only a progress bar based on the specified or implied date range and the date of the latest retrieved Tweet will be printed |
Based on a given Tweet search query and (optional) date range this function
iteratively retrieves all matching Tweets and stores the results in batches
as appropriately labelled JSON files; the complete set of results is split in
batches containing the (approximate) number of Tweets specified by
maxBatchSize
Tweets.
The calls to the search API endpoint are timed such that the API call limit of at most one call per second and 300 calls per 15 minute window is observed; this corresponds to a maximum of 150.000 Tweets that can be retrieved every 15 minutes (each individual API call returns at most 500 Tweets).
When running a query a progress bar in the console indicates how quickly data collection is advancing; progress is shown in relation to the (explicitly or implicitly) specified search time range and dates of the Tweets in the retrieved Tweet batches.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.