input: Write a function to extract titles of all YouTube videos from a given URL. The function should take a URL as input and return a list of video titles. If no titles are found, it should return an empty list. Ensure the function properly handles any errors and supports the provided example input.
  
  import requests
  import re
  
  def extract_youtube_titles(url):
      try:
          r = requests.get(url)
          r.raise_for_status()
          titles = re.findall('<a href="/watch\?v=([^"]+)">(.+?)<\/a>', r.content.decode('utf-8'))
          return [title[1] for title in titles]
      except requests.exceptions.RequestException:
          return []
  
  assert extract_youtube_titles("https://www.youtube.com/user/Thexvid/videos") != []
  assert extract_youtube_titles("https://www.youtube.com/user/DoesNotExist/videos") == []
  assert extract_youtube_titles("https://invalidurlformat") == []
output: def extract_youtube_titles(url):
      try:
          r = requests.get(url)
          r.raise_for_status()
          titles = re.findall('<a href="/watch\?v=([^"]+)">(.+?)<\/a>', r.content.decode('utf-8'))
          return [title[1] for title in titles]
      except requests.exceptions.RequestException:
          return []