# scrapehtml.rb HTML by miztea 2014 require 'open-uri' require 'nokogiri' if ARGV[0] == nil then puts "usage: $ ruby scrapehtml.rb [target HTML filename or URL]" exit end html = open(ARGV[0]) do |data| data.read end doc = Nokogiri::HTML.parse(html) doc.css('a').each do |anchor| puts anchor[:href] end