Skip to content

Instantly share code, notes, and snippets.

@maknoll
Created December 28, 2011 23:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maknoll/1530540 to your computer and use it in GitHub Desktop.
Save maknoll/1530540 to your computer and use it in GitHub Desktop.
parses json twitter objects from stdin and prints to stdout
#!/usr/bin/env ruby
require 'json'
while line = gets
if json = line.match(/\{.*\}/)
tweet = JSON.parse(json[0], :symbolize_names => true)
puts "@#{tweet[:user][:screen_name]}: #{tweet[:text]}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment