ytdl-org/youtube-dl · error · ExtractorError
Could not find XML element %s
Error message
Could not find XML element %s
What it means
Error "Could not find XML element %s" thrown in ytdl-org/youtube-dl.
Source
Thrown at youtube_dl/utils.py:1945
def xpath_element(node, xpath, name=None, fatal=False, default=NO_DEFAULT):
def _find_xpath(xpath):
return node.find(compat_xpath(xpath))
if isinstance(xpath, compat_basestring):
n = _find_xpath(xpath)
else:
for xp in xpath:
n = _find_xpath(xp)
if n is not None:
break
if n is None:
if default is not NO_DEFAULT:
return default
elif fatal:
name = xpath if name is None else name
raise ExtractorError('Could not find XML element %s' % name)
else:
return None
return n
def xpath_text(node, xpath, name=None, fatal=False, default=NO_DEFAULT):
n = xpath_element(node, xpath, name, fatal=fatal, default=default)
if n is None or n == default:
return n
if n.text is None:
if default is not NO_DEFAULT:
return default
elif fatal:
name = xpath if name is None else name
raise ExtractorError('Could not find XML element\'s text %s' % name)
else:
return None
return n.textView on GitHub (pinned to 956b8c5855)
Solutions
- Check that the XML document contains the expected element; update youtube-dl if the format changed.
When it happens
Trigger: Thrown at youtube_dl/utils.py:1945 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of ytdl-org/youtube-dl@956b8c5855 (2026-08-14).
Data as JSON: /api/errors/df4d8f39328c09dc.
Report an issue: GitHub.