{"record":{"id":"75a1cb32e30958d8","repo":"ytdl-org/youtube-dl","slug":"could-not-find-xml-attribute-s","errorCode":null,"errorMessage":"Could not find XML attribute %s","messagePattern":"Could not find XML attribute (.+?)","errorType":"exception","errorClass":"ExtractorError","httpStatus":null,"severity":"error","filePath":"youtube_dl/utils.py","lineNumber":1973,"sourceCode":"    if n.text is None:\n        if default is not NO_DEFAULT:\n            return default\n        elif fatal:\n            name = xpath if name is None else name\n            raise ExtractorError('Could not find XML element\\'s text %s' % name)\n        else:\n            return None\n    return n.text\n\n\ndef xpath_attr(node, xpath, key, name=None, fatal=False, default=NO_DEFAULT):\n    n = find_xpath_attr(node, xpath, key)\n    if n is None:\n        if default is not NO_DEFAULT:\n            return default\n        elif fatal:\n            name = '%s[@%s]' % (xpath, key) if name is None else name\n            raise ExtractorError('Could not find XML attribute %s' % name)\n        else:\n            return None\n    return n.attrib[key]\n\n\ndef get_element_by_id(id, html):\n    \"\"\"Return the content of the tag with the specified ID in the passed HTML document\"\"\"\n    return get_element_by_attribute('id', id, html)\n\n\ndef get_element_by_class(class_name, html):\n    \"\"\"Return the content of the first tag with the specified class in the passed HTML document\"\"\"\n    retval = get_elements_by_class(class_name, html)\n    return retval[0] if retval else None\n\n\ndef get_element_by_attribute(attribute, value, html, escape_value=True):\n    retval = get_elements_by_attribute(attribute, value, html, escape_value)","sourceCodeStart":1955,"sourceCodeEnd":1991,"githubUrl":"https://github.com/ytdl-org/youtube-dl/blob/956b8c585591b401a543e409accb163eeaaa1193/youtube_dl/utils.py#L1955-L1991","documentation":"Error \"Could not find XML attribute %s\" thrown in ytdl-org/youtube-dl.","triggerScenarios":"Thrown at youtube_dl/utils.py:1973 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check that the XML element has the expected attribute; update youtube-dl if the format changed."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"956b8c585591b401a543e409accb163eeaaa1193","analyzedAt":"2026-08-14T18:59:47.863Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}