Created
July 17, 2012 14:24
-
-
Save shizone/3129700 to your computer and use it in GitHub Desktop.
変態アドベントカレンダー in Summerに参加した物好きどもをTwitterのListに晒しあげるスクリプト
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
#!/usr/bin/env xsbtscript | |
!# | |
/*** | |
scalaVersion := "2.9.2" | |
libraryDependencies ++= Seq( | |
"org.twitter4j" % "twitter4j-core" % "[2.2,)" | |
) | |
*/ | |
import scala.xml.XML | |
import scala.io.Source | |
import twitter4j.TwitterFactory | |
import twitter4j.auth.AccessToken | |
// Get Hentais From ATND | |
val atndId = "29918" | |
val atndUrl = "http://api.atnd.org/events/users/?event_id=" | |
val encode = "utf8" | |
val hentaiIds = | |
XML.loadString(Source.fromURL(atndUrl + atndId, encode).getLines.mkString) \\ "twitter_id" map (_.text) | |
// Create And Add Hentai List | |
val consumerKey = "consumerKey" | |
val consumerSecret = "consumerSecret" | |
val token = "token" | |
val tokenSecret = "tokenSecret" | |
val accessToken = new AccessToken(token, tokenSecret) | |
val tw = new TwitterFactory().getInstance() | |
tw.setOAuthConsumer(consumerKey, consumerSecret) | |
tw.setOAuthAccessToken(accessToken) | |
val list = tw.createUserList("変態アドベントカレンダー in Summer", true, "この物好きな変態ども") | |
hentaiIds map (sn => tw.addUserListMember(list.getId, tw.showUser(sn).getId)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ひつようなもの:xsbtscript ( https://github.com/paulp/xsbtscript )
現状conscriptのlaunchconfigからscala-tools関連をすっぱ抜かないとエラーがもりもり出るのでセットアップするときに気をつけてね☆