input: Write a function to implement a web scraper in Python that extracts the top ten trending YouTube videos. The function should return a list of video titles. If the function fails to retrieve the data, it should return an empty list. If the URL is invalid, it should return an empty list.
  
  assert web_scraper("https://www.youtube.com/feed/trending")==['Video1', 'Video2', 'Video3', 'Video4', 'Video5', 'Video6', 'Video7', 'Video8', 'Video9', 'Video10']
  assert web_scraper("https://www.fakeurl/trending")==[]
  assert web_scraper("https://invalidurl")==[]
  assert web_scraper("")==[]
output: import requests
  from bs4 import BeautifulSoup
  
  def web_scraper(url):
      try:
          response = requests.get(url)
          response.raise_for_status()
          soup = BeautifulSoup(response.text, 'html.parser')
          video_titles = [title.text.strip() for title in soup.find_all('a', {'class': 'yt-simple-endpoint style-scope ytd-video-renderer'})[:10]]
          return video_titles
      except:
          return []