{"record":{"id":"6bb6490620b3259a","repo":"ytdl-org/youtube-dl","slug":"invalid-filter-specification-r","errorCode":null,"errorMessage":"Invalid filter specification %r","messagePattern":"Invalid filter specification %r","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"youtube_dl/YoutubeDL.py","lineNumber":1279,"sourceCode":"                '*=': lambda attr, value: value in attr,\n            }\n            str_operator_rex = re.compile(r'''(?x)\n                \\s*(?P<key>ext|acodec|vcodec|container|protocol|format_id|language)\n                \\s*(?P<negation>!\\s*)?(?P<op>%s)(?P<none_inclusive>\\s*\\?)?\n                \\s*(?P<value>[a-zA-Z0-9._-]+)\n                \\s*$\n                ''' % '|'.join(map(re.escape, STR_OPERATORS.keys())))\n            m = str_operator_rex.search(filter_spec)\n            if m:\n                comparison_value = m.group('value')\n                str_op = STR_OPERATORS[m.group('op')]\n                if m.group('negation'):\n                    op = lambda attr, value: not str_op(attr, value)\n                else:\n                    op = str_op\n\n        if not m:\n            raise ValueError('Invalid filter specification %r' % filter_spec)\n\n        def _filter(f):\n            actual_value = f.get(m.group('key'))\n            if actual_value is None:\n                return m.group('none_inclusive')\n            return op(actual_value, comparison_value)\n        return _filter\n\n    def _default_format_spec(self, info_dict, download=True):\n\n        def can_merge():\n            merger = FFmpegMergerPP(self)\n            return merger.available and merger.can_merge()\n\n        def prefer_best():\n            if self.params.get('simulate', False):\n                return False\n            if not download:","sourceCodeStart":1261,"sourceCodeEnd":1297,"githubUrl":"https://github.com/ytdl-org/youtube-dl/blob/956b8c585591b401a543e409accb163eeaaa1193/youtube_dl/YoutubeDL.py#L1261-L1297","documentation":"The interpreter loop in swfinterp.extract_function implements a fixed subset of AVM2 opcodes (roughly 0xD0-0xD7 register ops plus many others up to 0xD7/0x77 seen in the surrounding elif chain). Any opcode byte without a matching branch raises NotImplementedError('Unsupported opcode %d'). It means the SWF's bytecode uses an instruction youtube-dl never implemented — common for exotic Flash compiler output.","triggerScenarios":"Executing a method containing an unimplemented opcode: bit ops, type coercion instructions, exception handling (lookupswitch/throw), or anything produced by non-Adobe/obfuscating compilers. The numeric opcode in the message identifies exactly which instruction is missing.","commonSituations":"Site rotates to a player compiled with different settings or an obfuscator, introducing new opcodes in the deciphering function; attempts to interpret arbitrary ActionScript classes beyond the small surface youtube-dl needed.","solutions":["Identify the opcode via an AVM2 reference (the number in the message) and add an elif branch to the interpreter loop — nearby branches show the register/stack convention.","patch_function the containing method with a Python reimplementation so the opcode is never executed.","Update youtube-dl / use yt-dlp — or better, port the algorithm directly since SWF support is effectively frozen.","Long term, stop depending on SWF interpretation: extract the algorithm and reimplement it."],"exampleFix":"# before (swfinterp.py interpreter loop tail)\nelse:\n    raise NotImplementedError('Unsupported opcode %d' % opcode)\n\n# after: e.g. opcode 0xA0 = add\nelif opcode == 0xA0:  # add\n    a2 = stack.pop()\n    a1 = stack.pop()\n    stack.append(a1 + a2)\nelse:\n    raise NotImplementedError('Unsupported opcode %d' % opcode)","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    out = func(args)\nexcept NotImplementedError as e:\n    import re\n    m = re.search(r'Unsupported opcode (\\d+)', str(e))\n    if m:\n        # opcode number identifies the missing AVM2 instruction;\n        # implement it in the loop or patch the containing function\n        opcode = int(m.group(1))\n        raise ExtractorError('interpreter gap: AVM2 opcode %d' % opcode)\n    raise","preventionTips":["Map the reported opcode number to the AVM2 spec and add a branch to swfinterp's interpreter loop.","Patch the containing function in Python rather than growing the interpreter for one-off opcodes.","Prefer native reimplementation of signature algorithms; SWF interpretation is a frozen legacy path."],"tags":["swf","avm2","opcode","not-implemented"],"backgroundTag":null,"analyzedSha":"956b8c585591b401a543e409accb163eeaaa1193","analyzedAt":"2026-08-14T18:59:47.863Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}