Skip to content

Instantly share code, notes, and snippets.

View dnsguru's full-sized avatar
🖖
Straight up nerding out, proudly

Jothan Frakes dnsguru

🖖
Straight up nerding out, proudly
View GitHub Profile
@kjd
kjd / psl_missing_tlds.py
Last active August 30, 2022 23:27
Which TLDs are not in the Public Suffix List?
#!/usr/bin/env python3
import requests, idna
PUBLIC_SUFFIX_URL = 'https://publicsuffix.org/list/public_suffix_list.dat'
DELEGATED_TLDS_URL = 'https://data.iana.org/TLD/tlds-alpha-by-domain.txt'
current_suffixes = [x for x in requests.get(PUBLIC_SUFFIX_URL).text.split('\n') if x and not x.startswith('//')]
current_tlds = [idna.decode(x) for x in requests.get(DELEGATED_TLDS_URL).text.split('\n') if x and not x.startswith('#')]