Created
March 17, 2017 12:21
-
-
Save jamesthomson/cfb31282653fd4ec686c8c5a7a368d56 to your computer and use it in GitHub Desktop.
clean up twitter following
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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