input: Write a function to extract the titles of all YouTube videos from a given URL. The function should return a list of video titles. If no titles are found, it should return an empty list. If the input URL is invalid or the page cannot be retrieved, it should return None.
  assert extract_youtube_titles("https://www.youtube.com/user/Thexvid/videos")==['Title1', 'Title2', 'Title3']
  assert extract_youtube_titles("https://www.youtube.com/user/invalid_user/videos")==None
  assert extract_youtube_titles("https://www.youtube.com/")==[]
  assert extract_youtube_titles("https://www.youtube.com/user/Thexvid/")==[]
  assert extract_youtube_titles("")==None
output: import requests
  from bs4 import BeautifulSoup
  
  def extract_youtube_titles(url):
      try:
          response = requests.get(url)
          response.raise_for_status()
      except (requests.RequestException, ValueError):
          return None
      
      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