Skip to content

Commit c20f60b

Browse files
Merge pull request #302 from brondsem/more_assorted_fixes
fix .xyz, many "not found" situations, and .il and .nz creation dates
2 parents 25a9134 + 933e9de commit c20f60b

4 files changed

Lines changed: 98 additions & 94 deletions

File tree

test/samples/expected/google.co.il

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"domain_name": "google.co.il", "expiration_date": "2026-06-05 00:00:00+00:00", "updated_date": null, "registrar": "Domain The Net Technologies Ltd", "registrar_url": null, "creation_date": "1999-06-05 00:00:00+00:00", "status": "Transfer Locked"}

test/samples/whois/google.co.il

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
% The data in the WHOIS database of the .il registry is provided
2+
% by ISOC-IL for information purposes, and to assist persons in
3+
% obtaining information about or related to a domain name
4+
% registration record. ISOC-IL does not guarantee its accuracy.
5+
% By submitting a WHOIS query, you agree that you will use this
6+
% Data only for lawful purposes and that, under no circumstances
7+
% will you use this Data to: (1) allow, enable, or otherwise
8+
% support the transmission of mass unsolicited, commercial
9+
% advertising or solicitations via e-mail (spam);
10+
% or (2) enable high volume, automated, electronic processes that
11+
% apply to ISOC-IL (or its systems).
12+
% ISOC-IL reserves the right to modify these terms at any time.
13+
% By submitting this query, you agree to abide by this policy.
14+
15+
query: google.co.il
16+
17+
reg-name: google
18+
domain: google.co.il
19+
20+
descr: Google LLC.
21+
descr: 1600 Amphitheatre Parkway
22+
descr: Mountain View CA
23+
descr: 94043
24+
descr: USA
25+
phone: +1 650 3300100
26+
fax-no: +1 650 6188571
27+
e-mail: dns-admin AT google.com
28+
admin-c: DT-DA20915-IL
29+
tech-c: DT-DA19919-IL
30+
zone-c: DT-DA19919-IL
31+
nserver: ns1.google.com
32+
nserver: ns2.google.com
33+
nserver: ns3.google.com
34+
nserver: ns4.google.com
35+
assigned: 05-06-1999
36+
validity: 05-06-2026
37+
DNSSEC: unsigned
38+
status: Transfer Locked
39+
changed: registrar AT ns.il 19990605 (Assigned)
40+
changed: domain-registrar AT isoc.org.il 20020926 (Changed)
41+
changed: domain-registrar AT isoc.org.il 20050706 (Changed)
42+
changed: domain-registrar AT isoc.org.il 20070118 (Changed)
43+
changed: domain-registrar AT isoc.org.il 20170517 (Transferred)
44+
changed: domain-registrar AT isoc.org.il 20170517 (Changed)
45+
changed: domain-registrar AT isoc.org.il 20181216 (Changed)
46+
changed: domain-registrar AT isoc.org.il 20181216 (Changed)
47+
48+
person: Domain admin
49+
address Google Inc.
50+
address 1600 Amphitheatre Parkway
51+
address Mountain View CA
52+
address 94043
53+
address USA
54+
phone: +1 650 3300100
55+
fax-no: +1 650 6188571
56+
e-mail: ccops AT markmonitor.com
57+
nic-hdl: DT-DA20915-IL
58+
changed: Managing Registrar 20170329
59+
60+
person: Domain Admin
61+
address MarkMonitor Inc.
62+
address 3540 E Longwing Lane Suite 300
63+
address Meridian ID
64+
address 83646
65+
address USA
66+
phone: +1 208 3895740
67+
fax-no: +1 208 3895771
68+
e-mail: ccops AT markmonitor.com
69+
nic-hdl: DT-DA19919-IL
70+
changed: Managing Registrar 20161005
71+
changed: Managing Registrar 20170816
72+
73+
registrar name: Domain The Net Technologies Ltd
74+
registrar info: https://www.domainthenet.com
75+
76+
% Rights to the data above are restricted by copyright.

test/test_parser.py

Lines changed: 0 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -335,82 +335,6 @@ def test_cn_parse(self):
335335
}
336336
self._parse_and_compare("cnnic.com.cn", data, expected_results)
337337

338-
def test_il_parse(self):
339-
data = """
340-
query: python.org.il
341-
342-
reg-name: python
343-
domain: python.org.il
344-
345-
descr: Arik Baratz
346-
descr: PO Box 7775 PMB 8452
347-
descr: San Francisco, CA
348-
descr: 94120
349-
descr: USA
350-
phone: +1 650 6441973
351-
e-mail: hostmaster AT arik.baratz.org
352-
admin-c: LD-AB16063-IL
353-
tech-c: LD-AB16063-IL
354-
zone-c: LD-AB16063-IL
355-
nserver: dns1.zoneedit.com
356-
nserver: dns2.zoneedit.com
357-
nserver: dns3.zoneedit.com
358-
validity: 10-05-2018
359-
DNSSEC: unsigned
360-
status: Transfer Locked
361-
changed: domain-registrar AT isoc.org.il 20050524 (Assigned)
362-
changed: domain-registrar AT isoc.org.il 20070520 (Transferred)
363-
changed: domain-registrar AT isoc.org.il 20070520 (Changed)
364-
changed: domain-registrar AT isoc.org.il 20070520 (Changed)
365-
changed: domain-registrar AT isoc.org.il 20070807 (Changed)
366-
changed: domain-registrar AT isoc.org.il 20071025 (Changed)
367-
changed: domain-registrar AT isoc.org.il 20071025 (Changed)
368-
changed: domain-registrar AT isoc.org.il 20081221 (Changed)
369-
changed: domain-registrar AT isoc.org.il 20081221 (Changed)
370-
changed: domain-registrar AT isoc.org.il 20160301 (Changed)
371-
changed: domain-registrar AT isoc.org.il 20160301 (Changed)
372-
373-
person: Arik Baratz
374-
address: PO Box 7775 PMB 8452
375-
address: San Francisco, CA
376-
address: 94120
377-
address: USA
378-
phone: +1 650 9635533
379-
e-mail: hostmaster AT arik.baratz.org
380-
nic-hdl: LD-AB16063-IL
381-
changed: Managing Registrar 20070514
382-
changed: Managing Registrar 20081002
383-
changed: Managing Registrar 20081221
384-
changed: Managing Registrar 20081221
385-
changed: Managing Registrar 20090502
386-
387-
registrar name: LiveDns Ltd
388-
registrar info: http://domains.livedns.co.il
389-
"""
390-
expected_results = {
391-
"dnssec": "unsigned",
392-
"domain_name": "python.org.il",
393-
"emails": "hostmaster@arik.baratz.org",
394-
"expiration_date": datetime.datetime(2018, 5, 10, 0, 0, tzinfo=utc),
395-
"name_servers": [
396-
"dns1.zoneedit.com",
397-
"dns2.zoneedit.com",
398-
"dns3.zoneedit.com",
399-
],
400-
"phone": ["+1 650 6441973", "+1 650 9635533"],
401-
"referral_url": "http://domains.livedns.co.il",
402-
"registrant_address": [
403-
": PO Box 7775 PMB 8452",
404-
": San Francisco, CA",
405-
": 94120",
406-
": USA",
407-
],
408-
"registrant_name": "Arik Baratz",
409-
"registrar": "LiveDns Ltd",
410-
"status": "Transfer Locked",
411-
}
412-
self._parse_and_compare("python.org.il", data, expected_results)
413-
414338
def test_ie_parse(self):
415339
data = """
416340
refer: whois.weare.ie

whois/parser.py

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,8 @@ def load(domain: str, text: str):
427427
return WhoisCm(domain, text)
428428
elif domain.endswith(".hu"):
429429
return WhoisHu(domain, text)
430+
elif domain.endswith(".xyz"):
431+
return WhoisXyz(domain, text)
430432
else:
431433
return WhoisEntry(domain, text)
432434

@@ -446,7 +448,7 @@ class WhoisCl(WhoisEntry):
446448
}
447449

448450
def __init__(self, domain: str, text: str):
449-
if 'No match for "' in text:
451+
if 'No match for "' in text or "no entries found" in text:
450452
raise WhoisDomainNotFoundError(text)
451453
else:
452454
WhoisEntry.__init__(
@@ -474,7 +476,7 @@ class WhoisSG(WhoisEntry):
474476
}
475477

476478
def __init__(self, domain: str, text: str):
477-
if "Domain Not Found" in text:
479+
if "Domain Not Found" in text or text.lstrip().startswith('Not found: '):
478480
raise WhoisDomainNotFoundError(text)
479481
else:
480482
WhoisEntry.__init__(self, domain, text, self.regex)
@@ -511,7 +513,7 @@ class WhoisPe(WhoisEntry):
511513
}
512514

513515
def __init__(self, domain: str, text: str):
514-
if 'No match for "' in text:
516+
if 'No match for "' in text or "Domain Status: No Object Found" in text:
515517
raise WhoisDomainNotFoundError(text)
516518
else:
517519
WhoisEntry.__init__(self, domain, text, self.regex)
@@ -521,7 +523,7 @@ class WhoisSpace(WhoisEntry):
521523
"""Whois parser for .space domains"""
522524

523525
def __init__(self, domain: str, text: str):
524-
if 'No match for "' in text:
526+
if 'No match for "' in text or "The queried object does not exist: DOMAIN NOT FOUND" in text:
525527
raise WhoisDomainNotFoundError(text)
526528
else:
527529
WhoisEntry.__init__(self, domain, text)
@@ -588,7 +590,7 @@ class WhoisRo(WhoisEntry):
588590
}
589591

590592
def __init__(self, domain: str, text: str):
591-
if text.strip() == "NOT FOUND":
593+
if text.strip() == "NOT FOUND" or "No entries found for the selected source" in text:
592594
raise WhoisDomainNotFoundError(text)
593595
else:
594596
WhoisEntry.__init__(self, domain, text, self.regex)
@@ -672,7 +674,7 @@ class WhoisLt(WhoisEntry):
672674
}
673675

674676
def __init__(self, domain: str, text: str):
675-
if text.endswith("available"):
677+
if text.rstrip().endswith("available"):
676678
raise WhoisDomainNotFoundError(text)
677679
else:
678680
WhoisEntry.__init__(self, domain, text, self.regex)
@@ -917,7 +919,7 @@ class WhoisMe(WhoisEntry):
917919
}
918920

919921
def __init__(self, domain: str, text: str):
920-
if "NOT FOUND" in text:
922+
if "NOT FOUND" in text or "Domain not found" in text:
921923
raise WhoisDomainNotFoundError(text)
922924
else:
923925
WhoisEntry.__init__(self, domain, text, self.regex)
@@ -1155,7 +1157,7 @@ class WhoisEe(WhoisEntry):
11551157
}
11561158

11571159
def __init__(self, domain: str, text: str):
1158-
if text.strip() == "Domain not found":
1160+
if text.strip().startswith("Domain not found"):
11591161
raise WhoisDomainNotFoundError(text)
11601162
else:
11611163
WhoisEntry.__init__(self, domain, text, self.regex)
@@ -1220,7 +1222,7 @@ class WhoisKr(WhoisEntry):
12201222
}
12211223

12221224
def __init__(self, domain: str, text: str):
1223-
if text.endswith(" no match"):
1225+
if text.endswith(" no match") or "The requested domain was not found" in text:
12241226
raise WhoisDomainNotFoundError(text)
12251227
else:
12261228
WhoisEntry.__init__(self, domain, text, self.regex)
@@ -1266,7 +1268,7 @@ class WhoisBg(WhoisEntry):
12661268
dayfirst = True
12671269

12681270
def __init__(self, domain: str, text: str):
1269-
if "does not exist in database!" in text:
1271+
if "does not exist in database!" in text or "registration status: available" in text:
12701272
raise WhoisDomainNotFoundError(text)
12711273
else:
12721274
WhoisEntry.__init__(self, domain, text, self.regex)
@@ -2003,7 +2005,7 @@ class WhoisMx(WhoisEntry):
20032005
}
20042006

20052007
def __init__(self, domain: str, text: str):
2006-
if "not found." in text:
2008+
if "not found." in text or "Object_Not_Found" in text:
20072009
raise WhoisDomainNotFoundError(text)
20082010
else:
20092011
WhoisEntry.__init__(self, domain, text, self.regex)
@@ -2040,7 +2042,7 @@ class WhoisTw(WhoisEntry):
20402042
}
20412043

20422044
def __init__(self, domain: str, text: str):
2043-
if "not found." in text:
2045+
if "not found." in text or "No Found" in text:
20442046
raise WhoisDomainNotFoundError(text)
20452047
else:
20462048
WhoisEntry.__init__(self, domain, text, self.regex)
@@ -2075,7 +2077,7 @@ class WhoisTr(WhoisEntry):
20752077
}
20762078

20772079
def __init__(self, domain: str, text: str):
2078-
if "not found." in text:
2080+
if "not found." in text or "No match found for " in text:
20792081
raise WhoisDomainNotFoundError(text)
20802082
else:
20812083
WhoisEntry.__init__(self, domain, text, self.regex)
@@ -2206,6 +2208,7 @@ class WhoisIl(WhoisEntry):
22062208
regex: dict[str, str] = {
22072209
"domain_name": r"domain: *(.+)",
22082210
"expiration_date": r"validity: *(.+)",
2211+
"creation_date": r"assigned: *(.+)",
22092212
"registrant_name": r"person: *(.+)",
22102213
"registrant_address": r"address *(.+)",
22112214
"dnssec": r"DNSSEC: *(.+)",
@@ -2297,7 +2300,7 @@ class WhoisIe(WhoisEntry):
22972300
}
22982301

22992302
def __init__(self, domain: str, text: str):
2300-
if "no matching objects" in text:
2303+
if "no matching objects" in text or "Not found: " in text:
23012304
raise WhoisDomainNotFoundError(text)
23022305
else:
23032306
WhoisEntry.__init__(self, domain, text, self.regex)
@@ -2311,7 +2314,7 @@ class WhoisNz(WhoisEntry):
23112314
"registrar": r"(?:Registrar|registrar_name):\s*([^\n\r]+)",
23122315
"registrar_url": r"Registrar URL:\s*([^\n\r]+)",
23132316
"updated_date": r"(?:Updated Date|domain_datelastmodified):\s*([^\n\r]+)",
2314-
"creation_date": r"(?:Creation Date|domain_dateregistered):\s*([^\n\r]+)",
2317+
"creation_date": r"(?:Creation Date|domain_dateregistered|created):\s*([^\n\r]+)",
23152318
"expiration_date": r"domain_datebilleduntil:\s*([^\n\r]+)",
23162319
"name_servers": r"(?:Name Server|ns_name_\d*):\s*([^\n\r]+)", # list of name servers
23172320
"status": r"(?:Domain Status|status):\s*([^\n\r]+)", # list of statuses
@@ -2411,7 +2414,7 @@ class WhoisOnline(WhoisEntry):
24112414
}
24122415

24132416
def __init__(self, domain: str, text: str):
2414-
if "Not found:" in text:
2417+
if "Not found:" in text or "The queried object does not exist: DOMAIN NOT FOUND" in text:
24152418
raise WhoisDomainNotFoundError(text)
24162419
else:
24172420
WhoisEntry.__init__(self, domain, text, self.regex)
@@ -2530,7 +2533,7 @@ class WhoisUA(WhoisEntry):
25302533
}
25312534

25322535
def __init__(self, domain: str, text: str):
2533-
if "ERROR: No entries found" in text:
2536+
if "No entries found" in text:
25342537
raise WhoisDomainNotFoundError(text)
25352538
else:
25362539
WhoisEntry.__init__(
@@ -3538,7 +3541,7 @@ class WhoisCo(WhoisEntry):
35383541
"""Whois parser for .co domains"""
35393542

35403543
def __init__(self, domain, text):
3541-
if "No Data Found" in text:
3544+
if "No Data Found" in text or 'The queried object does not exist: DOMAIN NOT FOUND' in text:
35423545
raise WhoisDomainNotFoundError(text)
35433546
else:
35443547
WhoisEntry.__init__(self, domain, text, self.regex)

0 commit comments

Comments
 (0)