Skip to content
This repository was archived by the owner on Feb 3, 2024. It is now read-only.

Commit 6b134b1

Browse files
author
MooCow
authored
Merge pull request #227 from windgmbh/add-new-tlds
Add support for new Top Level Domains
2 parents 794f919 + f04816a commit 6b134b1

File tree

3 files changed

+35
-1
lines changed

3 files changed

+35
-1
lines changed

tests/ok-domains.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
google.eu
5050
google.fi
5151
google.fm
52+
google.fo
5253
google.fr
5354
google.game
5455
google.global
@@ -61,6 +62,8 @@
6162
google.is
6263
google.it
6364
google.jp
65+
google.kg
66+
google.kn
6467
google.link
6568
google.lt
6669
google.me
@@ -88,6 +91,7 @@
8891
google.tel
8992
google.theatre
9093
google.tickets
94+
google.tokyo
9195
google.trade
9296
google.tv
9397
google.us

whois/_3_adjust.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,8 @@ def __init__(
159159
"%Y%m%d%H%M%S", # 20071224102432 used in edu_ua
160160
"%Y-%m-%d %H:%M:%S (%Z%z)", # .tw uses (UTC+8) but we need (UTC+0800) for %z match
161161
"%d %B %Y at %H:%M:%S.%f", # 07 january 2020 at 23:38:30.772
162-
"%Y-%m-%d %H:%M:%S.%f %Z", # 2022-09-18 22:38:18.0 UTC (sn Senegal)
162+
"%Y-%m-%d %H:%M:%S.%f %Z", # 2022-09-18 22:38:18.0 UTC (sn Senegal),
163+
"%a %b %d %H:%M:%S %Y", # Thu Oct 21 05:54:20 2032 (kg Kyrgyzstan)
163164
]
164165

165166
CUSTOM_DATE_FORMATS = {
@@ -195,6 +196,9 @@ def str_to_date(text: str, tld: Optional[str] = None) -> Optional[datetime.datet
195196
# better here https://stackoverflow.com/questions/1258199/python-datetime-strptime-wildcard
196197
text = re.sub(r"(\d+)(st|nd|rd|th) ", r"\1 ", text)
197198

199+
# Remove consecutive whitespace
200+
text = re.sub(r"\s\s+", r" ", text)
201+
198202
# 07 january 2020 at 23:38:30.772
199203
# %d %B %Y at %H:%M %S.%f
200204
if tld and tld in CUSTOM_DATE_FORMATS:

whois/tld_regexpr.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,11 @@
404404
"extend": "com",
405405
}
406406

407+
fo = {
408+
"extend": "com",
409+
"registrant": None,
410+
}
411+
407412
fr = {
408413
"extend": "com",
409414
"domain_name": r"domain:\s?(.+)",
@@ -586,6 +591,23 @@
586591
"extend": "com",
587592
}
588593

594+
kg = {
595+
"extend": None,
596+
"domain_name": r"Domain\s(.+)\s\(",
597+
"registrar": r"Billing\sContact:\n.*\n\s+Name:\s(.+)\n",
598+
"registrant_country": None,
599+
"expiration_date": r"Record expires on:\s+(.+)",
600+
"creation_date": r"Record created:\s+(.+)",
601+
"updated_date": r"Record last updated on:\s+(.+)",
602+
"name_servers": None,
603+
"status": None,
604+
}
605+
606+
# Saint Kitts and Nevis
607+
kn = {
608+
"extend": "com",
609+
}
610+
589611
kr = {
590612
"extend": "com",
591613
"domain_name": r"Domain Name\s*:\s?(.+)",
@@ -964,6 +986,10 @@
964986
"emails": r"[\w.-]+@[\w.-]+\.[\w]{2,4}",
965987
}
966988

989+
tokyo = {
990+
"extend": "com",
991+
}
992+
967993
top = {
968994
"extend": "com",
969995
}

0 commit comments

Comments
 (0)