Python urlparse — extract domain name without subdomain
You probably want to check out tldextract, a library designed to do this kind of thing. It uses the Public Suffix List to try and get a decent split based on known gTLDs, but do note that this is just a brute-force list, nothing special, so it can get out of date (although hopefully it’s … Read more