Skip to content

Latest commit

 

History

History
15 lines (12 loc) · 727 Bytes

README.md

File metadata and controls

15 lines (12 loc) · 727 Bytes

Split hostnames to domain and effective TLD.

Based on Mozilla's effective TLD file found here (automatically downloaded on first run): https://mxr.mozilla.org/mozilla-central/source/netwerk/dns/effective_tld_names.dat?raw=1

Examples:

example.com           => ('example', 'com')   # Test com TLD
sub.example.com       => ('example', 'com')
sub.dub.example.com   => ('example', 'com')
example.co.uk         => ('example', 'co.uk') # Test *.uk eTLD
sub.example.co.uk     => ('example', 'co.uk')
sub.dub.example.co.uk => ('example', 'co.uk')
bl.uk                 => ('bl', 'uk')         # Exception to the normal *.uk 
example.frog          => None                 # Return None on invalid TLDs