{"record":{"id":"b4c4668f36aae165","repo":"ytdl-org/youtube-dl","slug":"invalid-syntax-in-cookie-header","errorCode":null,"errorMessage":"Invalid syntax in Cookie Header","messagePattern":"Invalid syntax in Cookie Header","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"youtube_dl/YoutubeDL.py","lineNumber":926,"sourceCode":"        \"\"\"\n        return dict(filter(lambda pair: pair[0].lower() != 'cookie', (http_headers or {}).items()))\n\n    def _load_cookies(self, data, **kwargs):\n        \"\"\"Loads cookies from a `Cookie` header\n\n        This tries to work around the security vulnerability of passing cookies to every domain.\n\n        @param data         The Cookie header as a string to load the cookies from\n        @param autoscope    If `False`, scope cookies using Set-Cookie syntax and error for cookie without domains\n                            If `True`, save cookies for later to be stored in the jar with a limited scope\n                            If a URL, save cookies in the jar with the domain of the URL\n        \"\"\"\n        # autoscope=True (kw-only)\n        autoscope = kwargs.get('autoscope', True)\n\n        for cookie in compat_http_cookies_SimpleCookie(data).values() if data else []:\n            if autoscope and any(cookie.values()):\n                raise ValueError('Invalid syntax in Cookie Header')\n\n            domain = cookie.get('domain') or ''\n            expiry = cookie.get('expires')\n            if expiry == '':  # 0 is valid so we check for `''` explicitly\n                expiry = None\n            prepared_cookie = compat_http_cookiejar_Cookie(\n                cookie.get('version') or 0, cookie.key, cookie.value, None, False,\n                domain, True, True, cookie.get('path') or '', bool(cookie.get('path')),\n                bool(cookie.get('secure')), expiry, False, None, None, {})\n\n            if domain:\n                self.cookiejar.set_cookie(prepared_cookie)\n            elif autoscope is True:\n                self.report_warning(\n                    'Passing cookies as a header is a potential security risk; '\n                    'they will be scoped to the domain of the downloaded urls. '\n                    'Please consider loading cookies from a file or browser instead.',\n                    only_once=True)","sourceCodeStart":908,"sourceCodeEnd":944,"githubUrl":"https://github.com/ytdl-org/youtube-dl/blob/956b8c585591b401a543e409accb163eeaaa1193/youtube_dl/YoutubeDL.py#L908-L944","documentation":"The AVM2 'getproperty' opcode (and related property reads) in swfinterp ends in a catch-all: if the (name, object) combination is not one of the explicitly handled pairs (string indexes, array slice/join, scope dicts, etc.), it raises NotImplementedError('Unsupported property %r on %r'). It signals that the interpreted ActionScript reads a property youtube-dl's interpreter never modeled.","triggerScenarios":"Interpreted bytecode executes getproperty where obj is an unhandled type (e.g. a dictionary/namespace object, a _AVMClass_Obj without that member, a Number/Boolean) or mname is an unhandled builtin (length on an unhandled container, charAt, push, etc. — only a handful are special-cased above the raise).","commonSituations":"Player SWF rotation introduces new property reads in the deciphering path; extractor authors prototyping with swfinterp hit gaps immediately; errors mention the exact property and object, which is the key debugging clue.","solutions":["Read the exception's (mname, obj) pair and add an elif branch for it just above the raise in swfinterp.py — the surrounding code shows the pattern (compute res, stack.append(res), continue).","If the property read belongs to a method you can reimplement, patch_function it in Python instead of extending the interpreter.","Update to the latest youtube-dl / yt-dlp; newly needed properties for big sites get added quickly.","If interpretation is optional for your flow, catch NotImplementedError and fall back to a non-interpreted extraction path."],"exampleFix":"# before (swfinterp.py, getproperty fallthrough)\nraise NotImplementedError(\n    'Unsupported property %r on %r' % (mname, obj))\n\n# after\nelif mname == 'charAt' and isinstance(obj, compat_str):\n    assert len(args) == 1\n    stack.append(obj[args[0]])\n    continue\nelse:\n    raise NotImplementedError(\n        'Unsupported property %r on %r' % (mname, obj))","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    out = func(args)\nexcept NotImplementedError as e:\n    if 'Unsupported property' in str(e):\n        # e.args carries (mname, obj) — add an elif branch for it or patch caller\n        mname, obj = e.args[0].split(' on ', 1)\n        raise ExtractorError('interpreter gap: property %s on %s' % (mname, obj))\n    raise","preventionTips":["Read the (property, object) pair from the message and extend the getproperty dispatch table in swfinterp.py.","Keep a Python reimplementation ready for the handful of methods your target player uses.","Pin a known-good SWF in tests to detect new property reads early."],"tags":["swf","avm2","property-access","not-implemented"],"backgroundTag":null,"analyzedSha":"956b8c585591b401a543e409accb163eeaaa1193","analyzedAt":"2026-08-14T18:59:47.863Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}