View source: R/get-upstream-tweets.R
get_upstream_tweets | R Documentation |
Because the Twitter API offers a in_reply_to_status_id_str
column, it is
possible to iteratively reconstruct reply threads in an upstream
direction, that is, retrieving statuses composed earlier than replies in
the dataset. The get_upstream_tweets()
function collects upstream
replies not previously found in the dataset. Keep in mind that there is no
way to predict how far upstream you can trace back a reply thread, so
running get_upstream_tweets()
could take a while and potentially hit
the Twitter API rate limit of 90,000 statuses in a 15-minute period.
get_upstream_tweets(df)
df |
A dataframe of statuses and full metadata from the Twitter API as
returned by |
This function requires authentication; please see
vignette("setup", package = "tidytags")
A new, expanded dataframe which includes any retrievable upstream replies
Read more about rtweet authentication setup at
vignette("auth", package = "rtweet")
example_url <- "18clYlQeJOc6W5QRuSlJ6_v3snqKJImFhU42bRkM_OX8"
tags_content <- read_tags(example_url)
if (rtweet::auth_has_default()) {
tweets_data <- lookup_many_tweets(tags_content)
more_replies_df <- get_upstream_tweets(tweets_data)
more_replies_df
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.