input: Write a function to extract titles of all YouTube videos from a given URL. The function should return a list of video titles. If the URL is invalid or no titles are found, the function should return an empty list.
  assert extract_youtube_titles("https://www.youtube.com/user/Thexvid/videos")==['First Video', 'Second Video', 'Third Video']
  assert extract_youtube_titles("https://www.youtube.com/user/InvalidChannel/videos")==[]
  assert extract_youtube_titles("https://www.youtube.com/watch?v=abcdefg")==[]
  assert extract_youtube_titles("https://invalidurl.com")==[]
output: import requests
  from bs4 import BeautifulSoup
  
  def extract_youtube_titles(url):
      try:
          response = requests.get(url)
          response.raise_for_status()
      except:
          return []
      
      soup = BeautifulSoup(response.text, 'html.parser')
      titles = soup.find_all('a', {'class': 'yt-simple-endpoint style-scope ytd-grid-video-renderer'})
      
      if not titles:
          return []
      
      return [title.get('title') for title in titles]