safe_get_timelines: Safely sample Twitter user timelines

Description Usage Arguments Details Value

View source: R/api-calls.R

Description

safe_get_timelines() is a drop-in replacement for rtweet::get_timelines() that automatically respects Twitter API rate limits and coordinates use of multiple Twitter access tokens that have been registered with register_token(). At the moment you can only request the friends list of 15 or fewer users in a single call.

Usage

1
safe_get_timelines(user, n = 100, max_id = NULL, home = FALSE, attempts = 5)

Arguments

user

Vector of user names, user IDs, or a mixture of both.

n

Number of tweets to return per timeline. Defaults to 100. Must be of length 1 or equal to length of user. This number should not exceed 3200 as Twitter limits returns to the most recent 3,200 statuses posted or retweeted by each user.

max_id

Character, returns results with an ID less than (that is, older than) or equal to 'max_id'.

home

Logical, indicating whether to return a user-timeline or home-timeline. By default, home is set to FALSE, which means get_timeline returns tweets posted by the given user. To return a user's home timeline feed, that is, the tweets posted by accounts followed by a user, set home to TRUE.

attempts

How many times should we attempt to access the Twitter API before giving up? Defaults to 5.

Details

If no tokens have been registered with socialsampler, safe_get_timelines() will look for a token registered with rtweet and use that token instead, again automatically respecting rate limits. If no tokens have been registered with either socialsampler or rtweet, you'll get an error.

Value

A tbl data frame of tweets data with users data attribute.


alexpghayes/socialsampler documentation built on Jan. 3, 2022, 6:54 p.m.