Skip to content

Instantly share code, notes, and snippets.

@shizone
Created July 17, 2012 14:24
Show Gist options
  • Save shizone/3129700 to your computer and use it in GitHub Desktop.
Save shizone/3129700 to your computer and use it in GitHub Desktop.
変態アドベントカレンダー in Summerに参加した物好きどもをTwitterのListに晒しあげるスクリプト
#!/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))
@shizone
Copy link
Author

shizone commented Jul 17, 2012

ひつようなもの:xsbtscript ( https://github.com/paulp/xsbtscript )
現状conscriptのlaunchconfigからscala-tools関連をすっぱ抜かないとエラーがもりもり出るのでセットアップするときに気をつけてね☆

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment