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 the titles of the top ten trending videos. If there are fewer than ten videos, it should return all available titles. If the request fails, it should return an empty list.
  
  def extract_trending_videos():
      try:
          page = requests.get("https://www.youtube.com/feed/trending")
          soup = BeautifulSoup(page.content, 'html.parser')
          trending_videos = soup.find_all(class_='expanded-shelf-content-item-wrapper')
          titles = [video.find(class_='yt-uix-tile-link').get('title') for video in trending_videos[:10]]
          return titles
      except:
          return []
  
  assert extract_trending_videos()[0] != None
  assert len(extract_trending_videos()) <= 10
  assert extract_trending_videos() != []
output: def extract_trending_videos():
      try:
          page = requests.get("https://www.youtube.com/feed/trending")
          soup = BeautifulSoup(page.content, 'html.parser')
          trending_videos = soup.find_all(class_='expanded-shelf-content-item-wrapper')
          titles = [video.find(class_='yt-uix-tile-link').get('title') for video in trending_videos[:10]]
          return titles
      except:
          return []