For a recent project I needed to update a hard-coded list of TLDs. Keeping it fresh seemed like a good idea, so I took IANA’s list of TLDs (IANA TLDs also available as text here) and made a little API service to provide the data in different formats:
ICANN provides the TLDs in upper case, but the Firtl API lower-cases them for convenience.