For example, the address is:
Address = http://lol1.domain.com:8888/some/page>
Address = http://lol1.domain.com:8888/some/page
We can use https://github.com/john-kurkowski/tldextract for this problem...
It's easy.
>>> ext = tldextract.extract('http://forums.bbc.co.uk') >>> (ext.subdomain, ext.domain, ext.suffix) ('forums', 'bbc', 'co.uk')