Skip to content

Instantly share code, notes, and snippets.

/ruby.rb Secret

Created April 19, 2015 00:59
Show Gist options
  • Save anonymous/5a592bae4fd16bcd5be6 to your computer and use it in GitHub Desktop.
Save anonymous/5a592bae4fd16bcd5be6 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'mechanize'
a = Mechanize.new { |agent|
agent.user_agent_alias = 'Mac Safari'
}
a.get('http://google.com/') do |page|
search_result = page.form_with(:name => 'f') do |search|
search.q = 'Hello world'
end.submit
search_result.links.each do |link|
#puts link.text
#puts link
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment