# File lib/hawlerhelper.rb, line 59 def self.brute_from_data(uri, data) links = Set.new URI.extract(data, ['http', 'https']).each do |l| l.gsub!(/['"].*/, '') # work around extract's inability to handle javascript l.gsub!(/^["']/, '') # remove leading quote(s) l.gsub!(/["']$/, '') # remove trailing quote(s) l.gsub!(/^\.\//, '') # handle "src=./foo" l = valid_uri(l) or next uri = valid_uri(uri) or next links << uri.merge(l).to_s end links.to_a end