Extracting Domain from URL

Look at the second answer from here:

Here's the lib they reference:

Looks fairly straightforward, hopefully it works out for you.