ytdl-org/youtube-dl · error · ExtractorError

Could not find XML element's text %s

Error message

Could not find XML element's text %s

What it means

Error "Could not find XML element's text %s" thrown in ytdl-org/youtube-dl.

Source

Thrown at youtube_dl/utils.py:1960

            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.text


def xpath_attr(node, xpath, key, name=None, fatal=False, default=NO_DEFAULT):
    n = find_xpath_attr(node, xpath, key)
    if n is None:
        if default is not NO_DEFAULT:
            return default
        elif fatal:
            name = '%s[@%s]' % (xpath, key) if name is None else name
            raise ExtractorError('Could not find XML attribute %s' % name)
        else:
            return None
    return n.attrib[key]

View on GitHub (pinned to 956b8c5855)

Solutions

  1. Check that the XML element contains text; update youtube-dl if the format changed.

When it happens

Trigger: Thrown at youtube_dl/utils.py:1960 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/f51d74a3c024705e. Report an issue: GitHub.