title: Extract count of specific links from a web page.
body: <p>I am writing a python script using BeautifulSoup. I need to scrape a website and count unique links ignoring the links starting with '#'.</p>
  
  <p>Example if the following links exist on a webpage:</p>
  
  <p><a href="https://www.stackoverflow.com/questions">https://www.stackoverflow.com/questions</a></p>
  
  <p><a href="https://www.stackoverflow.com/foo">https://www.stackoverflow.com/foo</a></p>
  
  <p><a href="https://www.cnn.com/" rel="nofollow noreferrer">https://www.cnn.com/</a></p>
  
  <p>For this example, the only two unique links will be (The link information after the main domain name is removed):</p>
  
  <pre><code>https://stackoverflow.com/    Count 2
  https://cnn.com/              Count 1
  </code></pre>
  
  <p>Note: this is my first time using python and web scraping tools.</p>
  
  <p>I appreciate all the help in advance. </p>
  
  <p>This is what I have tried so far:</p>
  
  <pre><code>from bs4 import BeautifulSoup
  import requests
  
  
  url = 'https://en.wikipedia.org/wiki/Beautiful_Soup_(HTML_parser)'
  
  r = requests.get(url)
  
  soup = BeautifulSoup(r.text, "html.parser")
  
  
  count = 0
  
  for link in soup.find_all('a'):
      print(link.get('href'))
      count += 1
  </code></pre>