input: Write a function to extract titles of all YouTube videos from a given URL using Python. 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 get_youtube_titles("https://www.youtube.com/user/Thexvid/videos")==["Video 1", "Video 2", "Video 3"]
  assert get_youtube_titles("https://example.com")==[]
  assert get_youtube_titles("https://www.youtube.com/user/wrong_user/videos")==[]
  assert get_youtube_titles("")==[]
output: import requests
  from bs4 import BeautifulSoup
  
  def get_youtube_titles(url):
      try:
          response = requests.get(url)
          response.raise_for_status()
          soup = BeautifulSoup(response.text, 'html.parser')
          titles = [title.text for title in soup.find_all('a', {'class': 'yt-simple-endpoint style-scope ytd-grid-video-renderer'})]
          return titles
      except:
          return []