barseghyanartur/tld

How get list of all valid tld ?

mhf-ir opened this issue · 4 comments

import tld

# Desire output: ['de', 'com', 'co.uk']
print(tld.which_method()) // ?

That functionality is not available. However, you could parse the source files to extract that information. May I ask, why would you need a simple list of all tlds?

iana.org will show which who is server will answer for tld. I need to get list of valid tlds around the world and find the latest update for who is list. your repo use public suffix well, and so on I interest to use this repo as source of tld list.
I think it's will be great if available, for further usage.

@mhf-ir: Ah, ok, that's the only valid use case I could think of. It's really easy to implement. However, for public names only. I'll think about that.

https://data.iana.org/TLD/tlds-alpha-by-domain.txt
Get the file from here, it contains the full list. You can ship a copy with your script as a fallback if no internet is available, or if functionality has been turned off.