{"record":{"id":"c4fea6dcb64f917d","repo":"yt-dlp/yt-dlp","slug":"unable-to-login-incorrect-username-and-or-passwor-c4fea6","errorCode":null,"errorMessage":"Unable to login: incorrect username and/or password","messagePattern":"Unable to login: incorrect username and/or password","errorType":"exception","errorClass":"ExtractorError","httpStatus":null,"severity":"error","filePath":"yt_dlp/extractor/zattoo.py","lineNumber":40,"sourceCode":"    def _real_initialize(self):\n        if not self._power_guide_hash:\n            self.raise_login_required('An account is needed to access this media', method='password')\n\n    def _perform_login(self, username, password):\n        try:\n            data = self._download_json(\n                f'{self._host_url()}/zapi/v2/account/login', None, 'Logging in',\n                data=urlencode_postdata({\n                    'login': username,\n                    'password': password,\n                    'remember': 'true',\n                }), headers={\n                    'Referer': f'{self._host_url()}/login',\n                    'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',\n                })\n        except ExtractorError as e:\n            if isinstance(e.cause, HTTPError) and e.cause.status == 400:\n                raise ExtractorError(\n                    'Unable to login: incorrect username and/or password',\n                    expected=True)\n            raise\n\n        self._power_guide_hash = data['session']['power_guide_hash']\n\n    def _initialize_pre_login(self):\n        session_token = self._download_json(\n            f'{self._host_url()}/token.json', None, 'Downloading session token')['session_token']\n\n        # Will setup appropriate cookies\n        self._request_webpage(\n            f'{self._host_url()}/zapi/v3/session/hello', None,\n            'Opening session', data=urlencode_postdata({\n                'uuid': str(uuid.uuid4()),\n                'lang': 'en',\n                'app_version': '1.8.2',\n                'format': 'json',","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/yt-dlp/yt-dlp/blob/81ecd58b1394793e6da9998cc19fdb45657f1685/yt_dlp/extractor/zattoo.py#L22-L58","documentation":"Raised during Zattoo login when POST {host}/zapi/v2/account/login returns HTTP 400. Zattoo uses 400 for rejected credentials, so the extractor converts it to a clear 'incorrect username and/or password' ExtractorError (expected=True). Any other HTTP status propagates unchanged.","triggerScenarios":"Calling a zattoo extractor with --username/--password (or netrc) credentials the API rejects; typos; wrong regional host (zattoo.com vs zattoo.de and other white-label hosts) where the account does not exist.","commonSituations":"Password changed but config still has the old one; account registered on a different Zattoo regional service than the URL being extracted; special characters in the password mangled by shell quoting; credentials stored in netrc with wrong formatting.","solutions":["Verify the username/password pair by logging in at the same host in a browser","Match the host: extract from the exact domain your account uses (zattoo.com, zattoo.de, etc.) or set --extractor-args accordingly","Quote the password correctly on the CLI (prefer --password via prompt or netrc to avoid shell mangling)","Prefer cookie-based auth (--cookies-from-browser) as an alternative when the API rejects programmatic logins"],"exampleFix":"# before\nyt-dlp --username me@mail.com --password 'p@ss' \"https://zattoo.com/...\"\n\n# after (correct quoting + right host, or skip password login entirely)\nyt-dlp --username me@mail.com --password 'p@ss word!' \"https://zattoo.com/...\"\nyt-dlp --cookies-from-browser firefox \"https://zattoo.com/...\"","handlingStrategy":"validation","validationCode":"# Sanity-check credentials (and host) before invoking the extractor\nusername, password = get_credentials()\nassert username and username.strip(), 'empty username'\nassert password, 'empty password'\nhost_ok = url.startswith('https://zattoo.')  # match the domain your account belongs to\nassert host_ok, 'zattoo host does not match the account region'","typeGuard":null,"tryCatchPattern":"from yt_dlp.utils import ExtractorError\ntry:\n    ydl.download([url])\nexcept ExtractorError as e:\n    if 'incorrect username and/or password' in str(e):\n        invalidate_stored_credentials()  # stop retrying a bad pair\n        raise\n    raise","preventionTips":["Store Zattoo credentials in netrc or a config file instead of CLI flags to avoid quoting bugs","Match account region and extraction host (zattoo.com/de/etc.)","On password change, update every stored credential immediately"],"tags":["zattoo","login","invalid-credentials","authentication"],"backgroundTag":"invalid-credentials","analyzedSha":"81ecd58b1394793e6da9998cc19fdb45657f1685","analyzedAt":"2026-08-22T12:21:25.439Z","schemaVersion":2},"datasetVersion":"2026-08-22T14:17:55.899Z"}