Registered Domain

back to: [tools] [homepage]


A small python script that can find (and/or extract) the "registered domain" (or effective TLD, or public suffix) in DNS domain names. It utilizes Mozilla's Public Suffix List

Some examples:

DNS name Registered Domain effective TLD bar com bar

The public suffix list is a text file. Ideally however we would want to have a python script (or module) that has the list "embedded" in its code, so that we don't have to read and parse the suffix list file every time the script is run. On the other hand we want to be able to update the list if necessary without too much pain.

We solve this by writing a generator script ( that can generate a python script (module) that has the logic implemented. One can to this by feeding an effective_tld_names.dat to the script on stdin. The generated python files is written to stdout:
./ < effective_tld_names.dat >
I have tested it and compared the output with regdom-libs. My scripts passed the test.


back to: [tools] [homepage]
Contact: Gregor Maier: gregor _AT_