Created
July 27, 2013 03:34
-
-
Save komiya-atsushi/6093601 to your computer and use it in GitHub Desktop.
TokyoWebmining の参加者 Twitter リストを作成する際に作ったプログラム。
実質 10 ステップで Twitter リストを作ることができます。そう、 #Twitter4J ならね。
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
import twitter4j.Twitter; | |
import twitter4j.TwitterException; | |
import twitter4j.TwitterFactory; | |
import twitter4j.UserList; | |
import java.io.File; | |
import java.io.IOException; | |
import java.nio.charset.Charset; | |
import java.nio.file.Files; | |
import java.util.List; | |
public class TokyoWebminingTwitterList { | |
public static void main(String[] args) throws IOException, TwitterException { | |
String accountFilename = "tokyowebmining-28.txt"; | |
String listName = "tokyowebmining-28"; | |
String description = "TokyoWebmining 28th の参加者リストです。"; | |
Twitter twitter = TwitterFactory.getSingleton(); | |
List<String> accounts = Files.readAllLines(new File(accountFilename).toPath(), Charset.defaultCharset()); | |
UserList twitterList = twitter.createUserList(listName, false, description); | |
twitter.createUserListMembers(twitterList.getId(), accounts.toArray(new String[0])); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment