A wrapper for the fantastic whois module that parses whois data into consistent JSON across multiple tlds. Supports proxies requiring authentication with username and password.
Inspiration (and regex) borrowed from the python library https://bitbucket.org/richardpenman/pywhois
If you find this package useful please give us a star!
npm install whois-parsed
var whoisOptions = {
proxy: {
ipaddress: '111.222.33.44',
port: 1085,
authentication: {
username: "youruser",
password: "yourpassword"
},
type: 5
}
};
(async function(){
const whois = require('whois-parsed');
var results = await whois.lookup('google.com', whoisOptions);
console.log(JSON.stringify(results, null, 2));
})()
Output:
{
"domainName": "google.com",
"updatedDate": "2018-02-21T10:45:07-0800",
"creationDate": "1997-09-15T00:00:00-0700",
"expirationDate": "2020-09-13T21:00:00-0700",
"registrar": "MarkMonitor, Inc.",
"status": [
"clientUpdateProhibited (https://www.icann.org/epp#clientUpdateProhibited)",
"clientTransferProhibited (https://www.icann.org/epp#clientTransferProhibited)",
"clientDeleteProhibited (https://www.icann.org/epp#clientDeleteProhibited)",
"serverUpdateProhibited (https://www.icann.org/epp#serverUpdateProhibited)",
"serverTransferProhibited (https://www.icann.org/epp#serverTransferProhibited)",
"serverDeleteProhibited (https://www.icann.org/epp#serverDeleteProhibited)"
],
"isAvailable": false
}
Domain Name being searched. Always populated.
true if the domain name is available. false if the domain name is currently registered. Always populated.
Array of status codes for the domain. Not populated for some TLDs.
Date the domain was first registered for this particular registration. This date is reset when a domain expires but not when a domain registration is renewed. Not populated for some TLDs.
Date the domain registration is set to expire. This date can be extended by the registrant. Not populated for some TLDs.
Date the domain WHOIS record was last updated. Not populated for some TLDs.
whois-parsed does not handle retry logic by design. It isn't uncommon to have whois lookups throw errors if your application gets blocked or rate limited due to too many whois calls. You should implement retry logic, rate limiting, proxies, etc. in your application as needed.
npm test
If you don't want to deal with proxies, rate limits, retries, etc. then you may be interested in a hosted domain availability API: https://rapidapi.com/moneals/api/domaination-io. This API gives you 10,000 free calls per month.
In lieu of a formal style guide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.