Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@mrflip
Created March 11, 2011 01:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrflip/865308 to your computer and use it in GitHub Desktop.
Save mrflip/865308 to your computer and use it in GitHub Desktop.
Here's a brittle but mostly-worky oneliner to turn a search result into an excel-loadable file
# run this in Terminal
curl "http://api.infochimps.com/social/network/tw/search/people_search?q=qualcomm&apikey=YOURAPIKEY" | ruby -rubygems -e 'require "json" ; $_ = $stdin.read.gsub(%r{^george_api_explorer\((.*)\)$}, "\\1") ; rows = JSON.load($_); ks= rows["results"].first.keys ; ks.sort! ; rows["results"].each{|row| puts row.values_at(*ks).map{|el| el.gsub(%r{[",]+},"") }.join(",") } ' > FILE_TO_SAVE_IN.csv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment