Created
June 25, 2011 11:42
-
-
Save irof/1046394 to your computer and use it in GitHub Desktop.
未フォローのフォロワーのリスト
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
@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