I have the same basic issue as discussed in this thread last year:
Justin C. points out the greatest difficulty with the situation,
i.e. that when dealing with a country code TLD, one may well have a
different number of parts (e.g. example.co.uk) than when dealing with
a gTLD (example.com).
The only solution that has occurred to me is to have a list of known
TLDs and second level domains (e.g. co.uk) that are insufficiently
specific, requiring a subdomain for additional specificity. The
problem is that this requires maintenance as well as initial research.
Does anyone have any suggestions for an alternative method to solve
this problem? I’m currently using Addressable:URI
parse the URLs and extract the host names.