I've been looking for a way to parse the domain from an URL. There's a ton of libraries but I haven't found a complete one. I'm currently using urllib.parse
. Which returns nothing when parsing a domain with a dash (-) in it. Are there other options I should concider using?
Example:
from urllib.parse import urlparse
print(urlparse("www.bax-shop.nl/muziekwinkel-goes").netloc)
Output:
Process finished with exit code 0
Edit:
It seems to be working with https://
in front of the URL. Which I find a bit strange.