I have a simple script I am testing and I always get timeout errors for 99% of my whois lookups, but if I run whois from the command line I get back results immediately. How do I change my script to work more like the commandline whois utility and not timeout?
here is my script:
require 'whois-parser'
words = %w[hello world]
second = %w[word world hello]
#who = Whois.whois(:timeout => 5)
words.each do |w|
second.each do |s|
d = "#{w}#{s}.com"
puts d
begin
r = Whois.whois(d)
p = r.parser
if p.available?
puts "#{d} AVAILABLE"
else
puts "#{d} NOT available"
end
rescue Timeout::Error => e
puts "timeout on lookup #{d}"
end
end
end
and the results I get:
helloword.com
timeout on lookup helloword.com
helloworld.com
timeout on lookup helloworld.com
hellohello.com
hellohello.com NOT available
worldword.com
timeout on lookup worldword.com
worldworld.com
worldworld.com NOT available
worldhello.com
worldhello.com NOT available
I have a simple script I am testing and I always get timeout errors for 99% of my whois lookups, but if I run whois from the command line I get back results immediately. How do I change my script to work more like the commandline whois utility and not timeout? here is my script:
and the results I get: