Created
January 29, 2010 23:53
-
-
Save tommorris/290274 to your computer and use it in GitHub Desktop.
Consuming Twitter XML in Scala (with Databinder Dispatch) vs. Ruby (with open-uri and Nokogiri)
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 dispatch._ | |
import Http._ | |
import scala.xml._ | |
var http = new Http() | |
var tweets = XML.loadString(http("http://twitter.com/statuses/user_timeline.xml?screen_name=tommorris" as_str)) | |
(tweets \\ "status" \ "text").toList.foreach(x => println(x.text)) |
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
require "open-uri" | |
require "nokogiri" | |
tweets = Nokogiri::XML(open("http://twitter.com/statuses/user_timeline.xml?screen_name=tommorris").readlines.join) | |
tweets.search("//status/text").each {|i| puts i.text } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The format changed:
https://api.twitter.com/1/statuses/user_timeline.xml?screen_name=tommorris