Skip to content

Instantly share code, notes, and snippets.

@dagi3d
Created October 29, 2011 00:28
Show Gist options
  • Save dagi3d/1323916 to your computer and use it in GitHub Desktop.
Save dagi3d/1323916 to your computer and use it in GitHub Desktop.
require 'uri'
require 'yajl/http_stream'
url = "http://search.twitter.com/search.json?q=real+madrid&geocode=40.427455,-3.67865,1mi"
out = Yajl::HttpStream.get(URI.parse(url))['results'].map {|t| t.values.map{|v| "'#{v}'"}.join(";")}.join("\n")
File.open("tweets.csv", "w") do |file|
file << out
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment