get_timeline()
returns the timeline of any Twitter user (i.e. what they
have tweeted). get_my_timeline()
returns the home timeline for the
authenticated user (i.e. the tweets you see when you log into Twitter).
get_timeline(
user = NULL,
n = 100,
since_id = NULL,
max_id = NULL,
home = FALSE,
parse = TRUE,
check = TRUE,
retryonratelimit = NULL,
verbose = TRUE,
token = NULL,
...
)get_my_timeline(
n = 100,
since_id = NULL,
max_id = NULL,
parse = TRUE,
check = TRUE,
retryonratelimit = NULL,
verbose = TRUE,
token = NULL,
...
)
A tbl data frame of tweets data with users data attribute.
Character vector of screen names or user ids.
See as_screenname()
for more details.
Desired number of results to return. Results are downloaded
in pages when n
is large; the default value will download a single
page. Set n = Inf
to download as many results as possible.
The Twitter API rate limits the number of requests you can perform
in each 15 minute period. The easiest way to download more than that is
to use retryonratelimit = TRUE
.
You are not guaranteed to get exactly n
results back. You will get
fewer results when tweets have been deleted or if you hit a rate limit.
You will get more results if you ask for a number of tweets that's not
a multiple of page size, e.g. if you request n = 150
and the page
size is 200, you'll get 200 results back.
Supply a vector of ids or a data frame of previous results to
find tweets newer than since_id
.
Supply a vector of ids or a data frame of previous results to
find tweets older than max_id
.
Logical, indicating whether to return a "user" timeline (the default, what a user has tweeted/retweeted) or a "home" timeline (what the user would see if they logged into twitter).
If TRUE
, the default, returns a tidy data frame. Use FALSE
to return the "raw" list corresponding to the JSON returned from the
Twitter API.
If TRUE
, and a rate limit is exhausted, will wait
until it refreshes. Most Twitter rate limits refresh every 15 minutes.
If FALSE
, and the rate limit is exceeded, the function will terminate
early with a warning; you'll still get back all results received up to
that point. The default value, NULL
, consults the option
rtweet.retryonratelimit
so that you can globally set it to TRUE
,
if desired.
If you expect a query to take hours or days to perform, you should not
rely solely on retryonratelimit
because it does not handle other common
failure modes like temporarily losing your internet connection.
Show progress bars and other messages indicating current progress?
Use this to override authentication for
a single API call. In many cases you are better off changing the
default for all calls. See auth_as()
for details.
Further arguments passed on as parameters in API query.
At most up to 3,200 of a user's most recent Tweets can be retrieved.
https://developer.twitter.com/en/docs/twitter-api/v1/tweets/timelines/overview
Other tweets:
get_favorites()
,
get_mentions()
,
lists_statuses()
,
lookup_tweets()
,
search_tweets()
if (auth_has_default()) {
tw <- get_timeline("_R_Foundation")
tw
# get tweets that arrived since the last request
get_timeline("_R_Foundation", since_id = tw)
# get earlier tweets
get_timeline("_R_Foundation", max_id = tw)
# get timelines for multiple users
tw <- get_timeline(c("_R_Foundation", "rOpenSci", "Bioconductor"))
tw
}
Run the code above in your browser using DataLab