Scrape Twitter friends and followers with R
First, download and install R Studio
Add the Rtweet Library to R Studio
Activate the library: library(rtweet)
Grab friends (people you follow) and then followers with the following commands (put your Twitter name where it says account name:
friends <- get_friends("account")
friends_data <- lookup_users(friends$to_id)
friends_clean <-data.frame(lapply(friends_data, as.character), stringsAsFactors=FALSE)
write_as_csv(friends_clean,"account_friends.csv")
followers<-get_followers("account",n=inf,retryonratelimit = TRUE)
followers_data<-lookup_users(followers$from_id)
followers_clean <-data.frame(lapply(followers_data, as.character), stringsAsFactors=FALSE)
write_as_csv(followers_clean,"account_followers.csv")
The two csv files should be in your Documents folder. You can upload them to Google sheets or Excel, etc.
Good luck! Not sure what to do with them next but at least you have them. I think you could search through for email addresses, mastodon links, etc...












