Skip to content

Instantly share code, notes, and snippets.

@carlocasorzo
Created February 19, 2015 15:37
Show Gist options
  • Save carlocasorzo/f1976146ab7290e243fa to your computer and use it in GitHub Desktop.
Save carlocasorzo/f1976146ab7290e243fa to your computer and use it in GitHub Desktop.
require 'mechanize'
agent = Mechanize.new
agent.get('http://masteringcoding.com/')
results = agent.page.search('.teaser-title a')
results.each { |result| puts "#{result.text} (#{result.attributes['href']})" }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment