input: Write a function to create a web scraper that extracts specific data from a given website using BeautifulSoup. The function should parse webpages, find HTML elements using tags and attributes, and extract the data into a desired format for storage. If the extraction is successful, return the extracted data as a list. If no data is found or an error occurs, return an empty list.
  assert web_scraper("http://example.com")==['/about', '/contact', '/services']
  assert web_scraper("http://nonexistent.com")==[]
  assert web_scraper("http://example.com/no_links")==[]
output: def web_scraper(url):
      try:
          import requests
          from bs4 import BeautifulSoup
          response = requests.get(url)
          response.raise_for_status()
          soup = BeautifulSoup(response.text, 'html.parser')
          links = soup.find_all('a', href=True)
          return [link['href'] for link in links]
      except:
          return []