getFriends: Returns the list of user IDs a given Twitter user follows

Description Usage Arguments Author(s) Examples

View source: R/get-friends.R

Description

getFriends connects to the REST API of Twitter and returns the list of user IDs a given user follows. Note that this function allows the use of multiple OAuth token to make the process more efficient.

Usage

1
2
getFriends(screen_name = NULL, oauth, cursor = -1, user_id = NULL,
  verbose = TRUE, sleep = 1)

Arguments

screen_name

user name of the Twitter user for which their friends will be downloaded

oauth

One of the following: either a list with details for an access token (see example below), a folder where OAuth tokens are stored, or a csv file with the format: consumer_key, consumer_secret, access_token, access_token_secret.

cursor

See https://dev.twitter.com/docs/api/1.1/get/friends/ids

user_id

user id of the Twitter user for which their friends will be downloaded

verbose

If TRUE, prints information about API calls on console

sleep

Number of seconds to sleep between API calls.

Author(s)

Pablo Barbera P.Barbera@lse.ac.uk

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
## Creating OAuth token
 my_oauth <- list(consumer_key = "CONSUMER_KEY",
   consumer_secret = "CONSUMER_SECRET",
   access_token="ACCESS_TOKEN",
   access_token_secret = "ACCESS_TOKEN_SECRET")
## Download list of friends of user "p_barbera"
 friends <- getFriends(screen_name="p_barbera", oauth=my_oauth)

## End(Not run)

lingeringcode/tweetscoresmod documentation built on Feb. 18, 2020, 5:28 p.m.