Skip to content

Instantly share code, notes, and snippets.

@mpen
Created November 6, 2009 11:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mpen/227942 to your computer and use it in GitHub Desktop.
Save mpen/227942 to your computer and use it in GitHub Desktop.
Twitter4jで公開タイムラインの取得
// Twitter4jで公開タイムラインの取得
import java.text.SimpleDateFormat
import scala.collection.jcl.Conversions.convertList
import twitter4j.{Status, Twitter}
object Twitter4jGetPublicTimeline {
def main(args: Array[String]) {
val twitter = new Twitter
val statuses = twitter.getPublicTimeline
val sdf = new SimpleDateFormat
statuses.foreach { status: Status =>
val user = status.getUser
val userScreenName = user.getScreenName
val userName = user.getName
val statusId = status.getId
val text = status.getText
val createdAt = sdf.format(status.getCreatedAt)
printf("%s(%s) | %s | %d | %s\n",
userName, userScreenName, createdAt, statusId, text)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment