Skip to content

Instantly share code, notes, and snippets.

@deminew
Forked from takaaki/get_recent_tweets.rb
Created April 19, 2009 18:52
Show Gist options
  • Save deminew/98168 to your computer and use it in GitHub Desktop.
Save deminew/98168 to your computer and use it in GitHub Desktop.
require "rubygems"
require 'mechanize'
agent = WWW::Mechanize.new
response = agent.get("http://twitter.com/statuses/user_timeline/samuraicoder.xml")
xml = response.content
doc = Nokogiri::XML(xml)
doc.search("text").each do |text|
p text.inner_html
end
require "rubygems"
require 'mechanize'
require 'active_support'
agent = WWW::Mechanize.new
response = agent.get("http://twitter.com/statuses/user_timeline/samuraicoder.json")
json = response.body
tweets = []
ActiveSupport::JSON::decode(json).each do |hash|
tweets << hash["text"]
end
p tweets
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment