input: Write a function to implement a web crawler that starts from a given URL and processes the web page by looking for other linked URLs within it and scrapes the page content for further analysis. The function should recursively visit all linked pages it finds and keep track of visited URLs. If the input URL is invalid, the function should return an empty list.
  
  def crawl(url):
   visited = set()
   queue = [url] 
   results = []
   
   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 
   results.append(soup.get_text())
  
   # 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'])
  
   return results if results else []
  
  assert crawl('http://example.com')==['This is the content of example.com']
  assert crawl('http://nonexistentwebsite.com')==[]
  assert crawl('http://websitewithlinks.com')==['Content of websitewithlinks.com', 'Content of linkedwebsite1.com']
  assert crawl('')==[]
output: def crawl(url):
      visited = set()
      queue = [url] 
      results = []
      
      while queue:
          curr = queue.pop(0)
          visited.add(curr) 
          try:
              response = requests.get(curr)
          except requests.exceptions.RequestException:
              continue
          
          if response.ok:
              soup = BeautifulSoup(response.text, 'html.parser')
  
              # scrape the page here 
              results.append(soup.get_text())
  
              # 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'])
  
      return results if results else []