Skip to content

Instantly share code, notes, and snippets.

@irof
Created June 25, 2011 11:42
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save irof/1046394 to your computer and use it in GitHub Desktop.
Save irof/1046394 to your computer and use it in GitHub Desktop.
未フォローのフォロワーのリスト
@Grab('org.twitter4j:twitter4j-core:2.2.3')
import twitter4j.*
import twitter4j.conf.*
def conf = new ConfigurationBuilder()
.setOAuthConsumerKey('consumer key')
.setOAuthConsumerSecret('consumer secret')
.setOAuthAccessToken('access token')
.setOAuthAccessTokenSecret('access token secret')
new TwitterFactory(conf.build()).instance.with{
def listId = it.createUserList('test', true, 'byGroovy').id
def friends = it.getFriendsIDs(it.id, -1).IDs.toSet()
it.getFollowersIDs(it.id, -1).IDs.findAll{
!friends.contains(it)
}.each{id ->
it.addUserListMember(listId, id)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment