input: Write a function to extract titles of all YouTube videos from a given URL. If no titles are found, the function should return an empty list. If the URL is invalid or cannot be accessed, the function should return an error message "Failed to access URL".
  def extract_youtube_titles(url):
      try:
          r = requests.get(url)
          if r.status_code != 200:
              return "Failed to access URL"
          titles = re.findall('<a href="/watch\?v=([^"]+)">(.+?)<\/a>', r.content.decode('utf-8'))
          return [title[1] for title in titles]
      except Exception as e:
          return "Failed to access URL"
  assert extract_youtube_titles("https://www.youtube.com/user/Thexvid/videos")==["Video1", "Video2", "Video3"]
  assert extract_youtube_titles("https://www.youtube.com/user/InvalidChannel/videos")=="Failed to access URL"
  assert extract_youtube_titles("https://invalid-url.com")=="Failed to access URL"
  assert extract_youtube_titles("https://www.youtube.com/user/EmptyChannel/videos")==[]
output: def extract_youtube_titles(url):
      try:
          r = requests.get(url)
          if r.status_code != 200:
              return "Failed to access URL"
          titles = re.findall('<a href="/watch\?v=([^"]+)">(.+?)<\/a>', r.content.decode('utf-8'))
          return [title[1] for title in titles]
      except Exception as e:
          return "Failed to access URL"