input: Write a function to extract the top ten trending YouTube videos using Python and BeautifulSoup. If the extraction is successful, the function should print the titles of the top ten videos. If the extraction fails, the function should print "Failed to extract trending videos."
  
  def extract_trending_videos():
      try:
          # make a request to get the page content
          page = requests.get("https://www.youtube.com/feed/trending")
          page.raise_for_status()
          
          # parse the page content
          soup = BeautifulSoup(page.content, 'html.parser')
          
          # extract the list of trending videos
          trending_videos = soup.find_all(class_='expanded-shelf-content-item-wrapper')
          
          # print the top ten trending videos
          for video in trending_videos[:10]:
              print(video.find(class_='yt-uix-tile-link').get('title'))
      except Exception as e:
          print("Failed to extract trending videos.")
  
  assert extract_trending_videos() is None
output: def extract_trending_videos():
      try:
          page = requests.get("https://www.youtube.com/feed/trending")
          page.raise_for_status()
          soup = BeautifulSoup(page.content, 'html.parser')
          trending_videos = soup.find_all(class_='expanded-shelf-content-item-wrapper')
          for video in trending_videos[:10]:
              print(video.find(class_='yt-uix-tile-link').get('title'))
      except Exception as e:
          print("Failed to extract trending videos.")