Skip to content

Instantly share code, notes, and snippets.

@bbq2100
Created October 15, 2014 20: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 bbq2100/25633b20371d4b27c9de to your computer and use it in GitHub Desktop.
Save bbq2100/25633b20371d4b27c9de to your computer and use it in GitHub Desktop.
Twitter search
import java.net.URL
import scala.io.Source
import scala.xml.XML
def tweets(handle: String) = {
println("Fetching tweets for specified handle: " + handle)
val source = Source.fromURL(new URL("https://twitter.com/search?q=" + handle))
val iterator: Iterator[String] = source.getLines()
val stringBuilder: StringBuilder = new StringBuilder
for(line <- iterator) stringBuilder.append(line)
XML.loadString(stringBuilder.toString())
}
tweets("scala")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment