Extract 2nd level domain from domain? - Python
The only possible way would be via a list with all the top level domains (here like .com or co.uk) possible. Then you would scan through this list and check out. I don't see any other way, at least without accessing the internet at runtime.
I have a list of domains e.g.

site.co.uk
site.com
site.me.uk
site.jpn.com
site.org.uk
site.it

also the domain names can contain 3rd and 4th level domains e.g.

test.example.site.org.uk
test2.site.com

I need to try and extract the 2nd level domain, in all these cases being site

Any ideas? :)