Created
December 16, 2012 11:24
-
-
Save nebuta/4306454 to your computer and use it in GitHub Desktop.
Ruby scraping benchmark code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'nokogiri' | |
require 'open-uri' | |
10.times do | |
doc = Nokogiri::HTML(open("http://www.w3.org/html/wg/drafts/html/master/single-page.html")) | |
puts(doc.css("ul > li").length.to_s + " elements.") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment