Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
clean up twitter following
library(twitteR)
#twitter authorisation
consumer_key = ''
consumer_secret = ''
access_token = ''
access_secret = ''
setup_twitter_oauth(consumer_key, consumer_secret, access_token, access_secret)
user<-getUser("inspirationinf")
user$getFollowersCount()
user$getFriendsCount()
followers<-user$getFollowers()
following<-user$getFriends()
followers_list<-NULL
for(i in 1:length(followers)){followers_list<-c(followers_list, followers[[i]]$screenName)}
following_list<-NULL
for(i in 1:length(following)){following_list<-c(following_list, following[[i]]$screenName)}
#people i follow that dont follow me
pifdfm<-following_list[!following_list%in%followers_list]
#posts by a user
last_tweet<-NULL
for(i in 1:length(pifdfm)){last_tweet<-c(last_tweet, max(twListToDF(userTimeline(pifdfm[i]))$created))}
pifdfm[as.POSIXct(last_tweet, origin="1970-01-01")<as.POSIXct((Sys.Date()-182),origin="1970-01-01")]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.