Skip to content

Instantly share code, notes, and snippets.

@tommorris
Created January 29, 2010 23:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tommorris/290274 to your computer and use it in GitHub Desktop.
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)
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))
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 }
@jbnunn
Copy link

jbnunn commented Jan 6, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment