Skip to content

Instantly share code, notes, and snippets.

@BYK
Last active August 29, 2015 14:03
Show Gist options
  • Save BYK/7e11eefd74aafa5693e8 to your computer and use it in GitHub Desktop.
Save BYK/7e11eefd74aafa5693e8 to your computer and use it in GitHub Desktop.
Fetch the most current list of TLDs and create a Python module from them
echo 'TLDS = (' > $1 &&
curl -f -sS https://data.iana.org/TLD/tlds-alpha-by-domain.txt -L |
awk '{print tolower($0)}' |
grep '^[[:alnum:]\-]\{1,63\}$' | sed 's/^.*$/"&",/g' >> $1 &&
echo ')' >> $1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment