Simple code to connect to twitter streaming api using Scala with scalaj-http

This is pretty simple stuff to do. Follow the following:

a) Get a twitter account, register an app on http://developer.twitter.com
b) Get the api keys
c) Open you scala IDE
e) Add scalaj-http lib to your project (do it yourself use maven or sbt)
d) Modify the code below to suit yourself

val consumer = Token(<Your Api Key>, <Your Api Secret>)

//note: by default scalaj-http has very little connection Timeout times
  val token = Http.post("https://api.twitter.com/oauth/request_token").param("oauth_callback", "oob")
    .oauth(consumer).options(HttpOptions.connTimeout(5000),
      HttpOptions.readTimeout(5000)).asToken

//DO THIS AND GET THE VERIFIER CODE 
  println("Go to https://api.twitter.com/oauth/authorize?oauth_token=" + token.key)

  val verifier = Console.readLine("Enter verifier: ").trim

  val accessToken = Http.post("https://api.twitter.com/oauth/access_token")
    .oauth(consumer, token, verifier).options(HttpOptions.connTimeout(5000),
      HttpOptions.readTimeout(5000)).asToken
//increased connection timeout to big value
   val request=Http("https://stream.twitter.com/1.1/statuses/filter.json").param("track","modi").oauth(consumer, accessToken).options(HttpOptions.connTimeout(500000),
      HttpOptions.readTimeout(500000))
     
 //streaming api read it continuously and do whatever with it
 //i am just printing it

 request.asHeadersAndParse {
      inputStream =>
         (Stream.continually(inputStream.read()).takeWhile(_ != -1).foreach(a=>print(a.asInstanceOf[Char])))
    }

You can send me thank you mail.