Skip to content

Instantly share code, notes, and snippets.

@cieux1
Created September 25, 2013 09:34
Show Gist options
  • Select an option

  • Save cieux1/6697284 to your computer and use it in GitHub Desktop.

Select an option

Save cieux1/6697284 to your computer and use it in GitHub Desktop.
gem whois example
require 'whois'
def get_whois_info(domains)
domains.each do |domain|
r = Whois::query(domain)
t = r.technical_contacts
begin
puts "#{domain}, #{t[0].email}, #{t[0].name}"
rescue => e
puts "#{domain}, #{e}"
end
sleep 50 + rand(20)
end
end
def extract_domains(urls)
arr = []
urls.each do |url|
arr << $1 if url =~ /^(.*?)\//
end
puts arr.uniq.size
arr.uniq
end
urls = ["foo.com/aaa/", "baa.com/bbb"]
get_whois_info(extract_domains(urls))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment