Description Usage Arguments Details Value See Also Examples
Returns a list of user IDs for the accounts following specified user. To return more than 75,000 user IDs in a single call (the rate limit maximum), set "retryonratelimit" to TRUE.
1 2 3 4 5 6 7 8 9 |
user |
Screen name or user ID of target user from which the user IDs of followers will be retrieved. |
n |
Number of followers to return. Defaults to 5000, which is the max number of followers returned by a single API request. Twitter allows up to 15 of these requests every 15 minutes, which means 75,000 is the max number of followers to return without waiting for the rate limit to reset. If this number exceeds either 75,000 or the remaining number of possible requests for a given token, then the returned object will only return what it can (less than n) unless retryonratelimit is set to true. |
page |
Default |
retryonratelimit |
If you'd like to retrieve more than 75,000
followers in a single call, then set |
parse |
Logical, indicating whether to return parsed vector or
nested list object. By default, |
verbose |
Logical indicating whether or not to print messages. Only relevant if retryonratelimit = TRUE. Defaults to TRUE, prints sleep times and followers gathered counts. |
token |
a twitter token. |
When retryonratelimit = TRUE
this function
internally makes a rate limit API call to get information on (a)
the number of requests remaining and (b) the amount of time until
the rate limit resets. So, in theory, the sleep call should only
be called once between waves of data collection. However, as a
fail safe, if a system's time is calibrated such that it expires
before the rate limit reset, or if, in another session, the user
dips into the rate limit, then this function will wait (use
Sys.sleep for a second time) until the next rate limit
reset. Users should monitor and test this before making
especially large calls as any systematic issues could create
sizable inefficiencies.
At this time, results are ordered with the most recent following first — however, this ordering is subject to unannounced change and eventual consistency issues. While this remains true it is possible to iteratively build follower lists for a user over time.
A data frame of follower IDs (one column named "user_id").
Other ids:
get_friends()
,
next_cursor()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | ## Not run:
## get 5000 ids of users following the KFC account
(kfc <- get_followers("KFC"))
## get max number [per fresh token] of POTUS follower IDs
(pres <- get_followers("potus", n = 75000))
## resume data collection (warning: rate limits reset every 15 minutes)
pres2 <- get_followers("potus", n = 75000, page = next_cursor(pres))
## store next cursor in object before merging data
nextpage <- next_cursor(pres2)
## merge data frames
pres <- rbind(pres, pres2)
## store next cursor as an attribute in the merged data frame
attr(pres, "next_cursor") <- next_page
## view merged ddata
pres
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.