Skip to content

Instantly share code, notes, and snippets.

@ybenjo
Created August 30, 2010 14:38
Show Gist options
  • Save ybenjo/557496 to your computer and use it in GitHub Desktop.
Save ybenjo/557496 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'mechanize'
require 'hpricot'
require 'open-uri'
agent = Mechanize.new
agent.user_agent_alias = 'Windows IE 7'
page = agent.get("https://twitter.com/login")
f = page.forms[0]
f["session[username_or_email]"] = "username"
f["session[password]"] = "password"
page = agent.submit(f)
########
puts Hpricot(page.body).inner_text
page = agent.get("http://twitter.com/Wagnaria/followers")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment