Created
November 22, 2009 08:21
-
-
Save mpen/240483 to your computer and use it in GitHub Desktop.
TwitterのPublic Timelineを取得し、ユーザ名とツイートを表示する
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
// TwitterのPublic Timelineを取得し、ユーザ名とツイートを表示する | |
// 元 http://gist.github.com/240444 | |
import scala.io.Source | |
import scala.xml.XML | |
val source = Source.fromURL("http://twitter.com/statuses/public_timeline.xml", "UTF-8") | |
val contents = source.getLines.mkString | |
val doc = XML.loadString(contents) | |
val tweets = | |
for (status <- doc \ "status") | |
yield ((status \ "user" \ "screen_name").text, (status \ "text").text) | |
for ((name, text) <- tweets) | |
println("@" + name + " : " + text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment