Created
October 15, 2014 20:24
-
-
Save bbq2100/25633b20371d4b27c9de to your computer and use it in GitHub Desktop.
Twitter search
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
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