Skip to content

Instantly share code, notes, and snippets.

@komiya-atsushi
Created July 27, 2013 03:34
Show Gist options
  • Save komiya-atsushi/6093601 to your computer and use it in GitHub Desktop.
Save komiya-atsushi/6093601 to your computer and use it in GitHub Desktop.
TokyoWebmining の参加者 Twitter リストを作成する際に作ったプログラム。 実質 10 ステップで Twitter リストを作ることができます。そう、 #Twitter4J ならね。
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