input: Write a function to create a web crawler in Python that starts from a given URL, looks for other links on the page, and scrapes the content of the page. The crawler should use BFS to visit links and keep track of visited URLs to avoid revisiting them. If the given URL is invalid, the function should handle it gracefully without crashing.
  
  def crawl(url):
   visited = set()
   queue = [url]
   
   while queue:
   curr = queue.pop(0)
   visited.add(curr)
   
   response = requests.get(curr)
   
   if response.ok:
   soup = BeautifulSoup(response.text, 'html.parser')
  
  # scrape the page here 
  
  # find all the links
   links = soup.find_all('a', href=re.compile('^http'))
   
   for link in links:
   if link['href'] not in visited:
   queue.append(link['href'])
  
  assert crawl('http://example.com')
  assert crawl('http://nonexistenturl1234567890.com')
output: 
  def crawl(url):
   visited = set()
   queue = [url]
   
   while queue:
   curr = queue.pop(0)
   visited.add(curr)
   
   try:
   response = requests.get(curr)
   
   if response.ok:
   soup = BeautifulSoup(response.text, 'html.parser')
  
  # scrape the page here 
  
  # find all the links
   links = soup.find_all('a', href=re.compile('^http'))
   
   for link in links:
   if link['href'] not in visited:
   queue.append(link['href'])
   except requests.exceptions.RequestException:
   pass
  