Skip to content

Commit 18c79e2

Browse files
Merge pull request #300 from python151/master
Adds xyz TLD support
2 parents 90edb22 + a33e30f commit 18c79e2

4 files changed

Lines changed: 78 additions & 0 deletions

File tree

test/samples/expected/abc.xyz

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"domain_name": "ABC.XYZ", "registry_domain_id": "D2192285-CNIC", "whois_server": "D2192285-CNIC", "registrar_url": null, "updated_date": "2025-03-10 15:22:23+00:00", "creation_date": "2014-03-20 12:59:17+00:00", "expiration_date": "2026-03-20 23:59:59+00:00", "registrar": "MarkMonitor, Inc (TLDs)", "regisrar_id": "292", "status": ["clientTransferProhibited https://icann.org/epp#clientTransferProhibited", "clientUpdateProhibited https://icann.org/epp#clientUpdateProhibited", "clientDeleteProhibited https://icann.org/epp#clientDeleteProhibited"], "name_servers": ["NS2.GOOGLE.COM", "NS4.GOOGLE.COM", "NS3.GOOGLE.COM", "NS1.GOOGLE.COM"], "dnssec": "unsigned", "registrar_email": "registryescalations@markmonitor.com", "registrar_phone": "+1.2083895740"}

test/samples/whois/abc.xyz

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
[whois.nic.xyz]
2+
Domain Name: ABC.XYZ
3+
Registry Domain ID: D2192285-CNIC
4+
Registrar WHOIS Server: whois.markmonitor.com
5+
Registrar URL:
6+
Updated Date: 2025-03-10T15:22:23.0Z
7+
Creation Date: 2014-03-20T12:59:17.0Z
8+
Registry Expiry Date: 2026-03-20T23:59:59.0Z
9+
Registrar: MarkMonitor, Inc (TLDs)
10+
Registrar IANA ID: 292
11+
Domain Status: clientTransferProhibited https://icann.org/epp#clientTransferProhibited
12+
Domain Status: clientUpdateProhibited https://icann.org/epp#clientUpdateProhibited
13+
Domain Status: clientDeleteProhibited https://icann.org/epp#clientDeleteProhibited
14+
Name Server: NS2.GOOGLE.COM
15+
Name Server: NS4.GOOGLE.COM
16+
Name Server: NS3.GOOGLE.COM
17+
Name Server: NS1.GOOGLE.COM
18+
DNSSEC: unsigned
19+
Registrar Abuse Contact Email: registryescalations@markmonitor.com
20+
Registrar Abuse Contact Phone: +1.2083895740
21+
URL of the ICANN Whois Inaccuracy Complaint Form: https://www.icann.org/wicf/
22+
>>> Last update of WHOIS database: 2025-10-10T02:49:26.0Z <<<
23+
24+
For more information on Whois status codes, please visit https://icann.org/epp
25+
26+
>>> IMPORTANT INFORMATION ABOUT THE DEPLOYMENT OF RDAP: please visit
27+
https://www.centralnicregistry.com/support/information/rdap <<<
28+
29+
The registration data available in this service is limited. Additional
30+
data may be available at https://lookup.icann.org
31+
32+
The Whois and RDAP services are provided by CentralNic, and contain
33+
information pertaining to Internet domain names registered by our
34+
our customers. By using this service you are agreeing (1) not to use any
35+
information presented here for any purpose other than determining
36+
ownership of domain names, (2) not to store or reproduce this data in
37+
any way, (3) not to use any high-volume, automated, electronic processes
38+
to obtain data from this service. Abuse of this service is monitored and
39+
actions in contravention of these terms will result in being permanently
40+
blacklisted. All data is (c) CentralNic Ltd (https://www.centralnicregistry.com)
41+
42+
Access to the Whois and RDAP services is rate limited. For more
43+
information, visit https://centralnicregistry.com/policies/whois-guidance.
44+
45+

whois/parser.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3570,3 +3570,32 @@ def __init__(self, domain: str, text: str):
35703570
raise WhoisDomainNotFoundError(text)
35713571
else:
35723572
WhoisEntry.__init__(self, domain, text, self.regex)
3573+
3574+
3575+
class WhoisXyz(WhoisEntry):
3576+
"""Whois parser for .xyz domains"""
3577+
3578+
regex: dict[str, str] = {
3579+
"domain_name": r"Domain Name: *(.+)",
3580+
"registry_domain_id": r"Registry Domain ID: *(.+)",
3581+
"whois_server": r"Registrar WHOIS Server: *(.+)",
3582+
"registrar_url": r"Registrar URL: *(.+)",
3583+
"updated_date": r"Updated Date: *(.+)",
3584+
"creation_date": r"Creation Date: *(.+)",
3585+
"expiration_date": r"Registry Expiry Date: *(.+)",
3586+
"registrar": r"Registrar: *(.+)",
3587+
"registrar_id": r"Registrar IANA ID: *(.+)",
3588+
"status": r"Domain Status: *(.+)", # list of statuses
3589+
"name_servers": r"Name Server: *(.+)", # list of name servers
3590+
"dnssec": r"DNSSEC: *(.+)",
3591+
"registrar_email": r"Registrar Abuse Contact Email: *(.+)",
3592+
"registrar_phone": r"Registrar Abuse Contact Phone: *(.+)",
3593+
}
3594+
3595+
def __init__(self, domain: str, text: str):
3596+
if 'The queried object does not exist: DOMAIN NOT FOUND' in text:
3597+
raise WhoisDomainNotFoundError(text)
3598+
else:
3599+
WhoisEntry.__init__(self, domain, text, self.regex)
3600+
3601+

whois/whois.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ class NICClient:
113113
TN_HOST = "whois.ati.tn"
114114
SBS_HOST = "whois.nic.sbs"
115115
GA_HOST = "whois.nic.ga"
116+
XYZ_HOST = "whois.nic.xyz"
116117

117118
SITE_HOST = "whois.nic.site"
118119
DESIGN_HOST = "whois.nic.design"
@@ -409,6 +410,8 @@ def choose_server(self, domain: str) -> Optional[str]:
409410
return NICClient.SITE_HOST
410411
elif tld == "ga":
411412
return NICClient.GA_HOST
413+
elif tld == "xyz":
414+
return NICClient.XYZ_HOST
412415
else:
413416
return self.findwhois_iana(tld)
414417
# server = tld + NICClient.QNICHOST_TAIL

0 commit comments

Comments
 (0)