rubywhois-ruby

Contact info empty/not parsed for domains from some registrars


I'm starting to use whoisrb and I'm noticing domains from some registrars return nil contact information.

For example:

domain_name = ARGV[0]
r = Whois.whois(domain_name)

t=r.registrant_contact
  if t == nil
  puts 'Registrant Contact is empty.'
end

Will return "Registrant Contact is empty." Trying to access the contact attributes results in an error, like undefined method 'id' for nil:NilClass (NoMethodError).

If I check the raw record that's being returned, puts r, I can see it's getting the thick record, so the contact information is there in the unparsed raw record.

The two registrars I've noticed this for, so far, are onlinenic.com and namesilo.com. If you try to run whois for those two domains, you'll see what I mean.

I'm checking the ICANN compliant sample here:

https://www.icann.org/resources/pages/approved-with-specs-2013-09-17-en#whois

against onlinenic.com and namesilo.com, and I don't see any substantial differences (maybe I'm missing something, though).

Any ideas why it's having trouble parsing these, or pointers on what I could check to fix it? Thanks.


Solution

  • It happens when the registrar has no parser associated, or the parser doesn't have the definition required to parse the contacts.

    In other words, unless a parser exists, it's possible that the registrar details are in the response but the library can't find them.

    In that case, the solution is to either add/update the parser corresponding to the specific registrar/registry.

    Since this behavior is confusing to whoever is not familiar with the internals of the library, also note that the new release 4 will raise an error in this case (instead of silently returning nil). In this way it will be clear when the value is nil vs the value is unknown.