This function collects tweets containing strings or hashtags between specified date ranges that also contain (a recognized URL to) an image. Tweet-level data is stored in a data/ path as a series of JSONs beginning "data_"; User-level data is stored as a series of JSONs beginning "users_". If a filename is supplied, this function will save the result as a RDS file, otherwise it will return the results as a dataframe.
get_image_tweets(
query,
start_tweets,
end_tweets,
bearer_token = get_bearer(),
n = 100,
file = NULL,
data_path = NULL,
bind_tweets = TRUE,
verbose = TRUE,
...
)
string or character vector, search query or queries
string, starting date
string, ending date
string, bearer token
integer, upper limit of tweets to be fetched
string, name of the resulting RDS file
string, if supplied, fetched data can be saved to the designated path as jsons
If TRUE
, tweets captured are bound into a data.frame for assignment
If FALSE
, query progress messages are suppressed
arguments will be passed to build_query()
function. See ?build_query()
for further information.
a data.frame
# NOT RUN {
bearer_token <- "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
get_image_tweets("#BLM", "2020-01-01T00:00:00Z", "2020-01-05T00:00:00Z",
bearer_token, data_path = "data/")
# }
Run the code above in your browser using DataLab