title: Get second level domain name from URL
body: <p>Is there a way to get top level domain name from the url</p>
  
  <p>for e.g., "<a href="https://images.google.com/blah" rel="noreferrer">https://images.google.com/blah</a>" => "google"</p>
  
  <p>I found this: </p>
  
  <pre><code>var domain = new URL(pageUrl).hostname; 
  </code></pre>
  
  <p>but it gives me "images.google.com" instead of just google.</p>
  
  <p>Unit tests I have are:</p>
  
  <pre><code>https://images.google.com   =&gt; google
  https://www.google.com/blah =&gt; google
  https://www.google.co.uk/blah =&gt; google
  https://www.images.google.com/blah =&gt; google
  </code></pre>