{"record":{"id":"b1fea0e01250d28d","repo":"yt-dlp/yt-dlp","slug":"wrong-username-or-password","errorCode":null,"errorMessage":"wrong username or password","messagePattern":"wrong username or password","errorType":"exception","errorClass":"ExtractorError","httpStatus":null,"severity":"error","filePath":"yt_dlp/extractor/brilliantpala.py","lineNumber":53,"sourceCode":"\n        if urlh.status == 401:\n            self.write_debug('Got HTTP Error 401; cookies have been invalidated')\n            login_page = self._download_webpage(self._LOGIN_API, None, 'Re-downloading login page')\n\n        login_form = self._hidden_inputs(login_page)\n        login_form.update({\n            'username': username,\n            'password': password,\n        })\n        self._set_cookie(self._DOMAIN, 'csrftoken', login_form['csrfmiddlewaretoken'])\n\n        logged_page = self._download_webpage(\n            self._LOGIN_API, None, note='Logging in', headers={'Referer': self._LOGIN_API},\n            data=urlencode_postdata(login_form))\n\n        if self._html_search_regex(\n                r'(Your username / email and password)', logged_page, 'auth fail', default=None):\n            raise ExtractorError('wrong username or password', expected=True)\n\n        # the maximum number of logins is one\n        if self._html_search_regex(\n                r'(Logout Other Devices)', logged_page, 'logout devices button', default=None):\n            logout_device_form = self._hidden_inputs(logged_page)\n            self._download_webpage(\n                self._LOGOUT_DEVICES_API, None, headers={'Referer': self._LOGIN_API},\n                note='Logging out other devices', data=urlencode_postdata(logout_device_form))\n\n    def _real_extract(self, url):\n        course_id, content_id = self._match_valid_url(url).group('course_id', 'content_id')\n        video_id = f'{course_id}-{content_id}'\n\n        username = self._get_logged_in_username(url, video_id)\n\n        content_json = self._download_json(\n            self._CONTENT_API.format(content_id=content_id), video_id,\n            note='Fetching content info', errnote='Unable to fetch content info')","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/yt-dlp/yt-dlp/blob/81ecd58b1394793e6da9998cc19fdb45657f1685/yt_dlp/extractor/brilliantpala.py#L35-L71","documentation":"Thrown by the Brilliant Pala login flow after the POST to the login API returns a page containing 'Your username / email and password'. The extractor matched the site's own login-failure marker, so the credentials were rejected by the server, not by yt-dlp.","triggerScenarios":"Running yt-dlp with --username/--password (or netrc machine brilliantpala) against a Brilliant Pala course URL where the submitted credentials are wrong: the server responds with the login form again plus the failure text, and the regex hits.","commonSituations":"Typo'd or rotated password; credentials for a different service pasted in; quoting problems in the shell mangling the password; account that exists but has no active subscription/course access.","solutions":["Re-enter credentials carefully: yt-dlp --username 'you@example.com' --password '...' URL (or use --netrc so the password is not typed inline).","Verify the same credentials log in at the site in a browser before blaming yt-dlp.","Check shell quoting: single-quote the password; beware trailing spaces and ! history expansion in some shells.","If login works in a browser but not in yt-dlp, update yt-dlp and otherwise report at https://github.com/yt-dlp/yt-dlp/issues."],"exampleFix":"# before (wrong password)\nyt-dlp --username me@mail.com --password hunter3 'https://learn.brilliantpala.org/courses/...'\n# after\nyt-dlp --username me@mail.com --password 'correct horse' 'https://learn.brilliantpala.org/courses/...'","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    with YoutubeDL({'username': user, 'password': pw}) as ydl:\n        ydl.extract_info(url)\nexcept ExtractorError as e:\n    if 'wrong username or password' in str(e):\n        raise CredentialsError('brilliantpala login rejected') from e\n    raise","preventionTips":["Load credentials from .netrc (machine brilliantpala) instead of CLI flags to avoid shell quoting bugs.","Pre-validate credentials by logging in once in a browser with the same values.","Catch the expected error and surface a 're-enter credentials' prompt instead of a stack trace in tooling."],"tags":["brilliantpala","login","credentials","authentication","netrc"],"backgroundTag":"invalid-credentials","analyzedSha":"81ecd58b1394793e6da9998cc19fdb45657f1685","analyzedAt":"2026-08-22T12:21:25.439Z","schemaVersion":2},"datasetVersion":"2026-08-22T14:17:55.899Z"}