class Page def initialize(url) @url = url @page = fetch! @page_as_object= nokogiri_parser end def fetch! Net::HTTP.get(URI.parse(@url)) end def nokogiri_parser Nokogiri::HTML(@page) end def title @page_as_object.search('head title').text end def links @page_as_object.search('a').map{|link| link['href'].match(/https?:.+/)}.compact.map{|link| link[0]} # Research alert! # How do you use Nokogiri to extract all the link URLs on a page? # # These should only be URLs that look like # Click here! # This would pull out "http://somesite.com/page.html" end end