TwitteR R package how to create friendships (follow = true)
I would like to know if it is already possible to create a friendship request using the create_friendship (id = ...) method? I don't know how to write it in R.
This is what I tried:
url.create.friendships <- "https://api.twitter.com/1.1/friendships/create.json"
parametres <- "follow=true&user_id=MY_FRIEND_ID"
twitCred$OAuthRequest(URL=url.create.friendships,
params=parametres)
R returns this:
Error: Authorization Required
NB: twitCred is ok (handshakeComplete = TRUE) and I can use all the features of a package like searchTwitter()
+3
source to share
1 answer
This worked for me:
library("twitteR")
library('base64enc') #to correctly authenticate
library("httpuv")
setup_twitter_oauth("xxxxx","xxxxxxxx")
friendships(screen_names = c('user1', 'user2'))
This returns a frame of user data and their friendship status (whether you follow or follow them). In the meantime, there is no need to worry about it. ”
0
source to share