input: 
  from typing import Set, List
  import requests
  from bs4 import BeautifulSoup
  import re
  
  def crawl(url: str, max_depth: int = 3) -> List[str]:
      """
      A web crawler that starts from a given URL and recursively looks for other 
      links in the page, scraping the page content, and continues this process up to a specified depth.
      
      Args:
      - url (str): The initial URL to begin crawling.
      - max_depth (int): The maximum depth to which the crawler should go. Default is 3.
      
      Returns:
      - List[str]: A list of visited URLs, sorted in the order they were visited.
      
      >>> crawl('http://example.com', max_depth=1)
      ['http://example.com', 'http://example.com/link1', 'http://example.com/link2']
      >>> crawl('http://example.com', max_depth=2)
      ['http://example.com', 'http://example.com/link1', 'http://example.com/link2', 'http://example.com/link3']
      """
  
output:     
      visited = []
      queue = [(url, 0)]
      while queue:
          current_url, depth = queue.pop(0)
          if current_url in visited:
              continue
          visited.append(current_url)
          if depth >= max_depth:
              continue
          try:
              response = requests.get(current_url)
              if response.status_code == 200:
                  soup = BeautifulSoup(response.text, 'html.parser')
                  for link in soup.find_all('a', href=True):
                      new_url = link['href']
                      if new_url.startswith('http'):
                          queue.append((new_url, depth + 1))
          except requests.RequestException:
              continue
      return visited
  