yt-dlp/yt-dlp · error · ExtractorError

wrong username or password

Error message

wrong username or password

What it means

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.

Source

Thrown at yt_dlp/extractor/brilliantpala.py:53

        if urlh.status == 401:
            self.write_debug('Got HTTP Error 401; cookies have been invalidated')
            login_page = self._download_webpage(self._LOGIN_API, None, 'Re-downloading login page')

        login_form = self._hidden_inputs(login_page)
        login_form.update({
            'username': username,
            'password': password,
        })
        self._set_cookie(self._DOMAIN, 'csrftoken', login_form['csrfmiddlewaretoken'])

        logged_page = self._download_webpage(
            self._LOGIN_API, None, note='Logging in', headers={'Referer': self._LOGIN_API},
            data=urlencode_postdata(login_form))

        if self._html_search_regex(
                r'(Your username / email and password)', logged_page, 'auth fail', default=None):
            raise ExtractorError('wrong username or password', expected=True)

        # the maximum number of logins is one
        if self._html_search_regex(
                r'(Logout Other Devices)', logged_page, 'logout devices button', default=None):
            logout_device_form = self._hidden_inputs(logged_page)
            self._download_webpage(
                self._LOGOUT_DEVICES_API, None, headers={'Referer': self._LOGIN_API},
                note='Logging out other devices', data=urlencode_postdata(logout_device_form))

    def _real_extract(self, url):
        course_id, content_id = self._match_valid_url(url).group('course_id', 'content_id')
        video_id = f'{course_id}-{content_id}'

        username = self._get_logged_in_username(url, video_id)

        content_json = self._download_json(
            self._CONTENT_API.format(content_id=content_id), video_id,
            note='Fetching content info', errnote='Unable to fetch content info')

View on GitHub (pinned to 81ecd58b13)

Solutions

  1. Re-enter credentials carefully: yt-dlp --username 'you@example.com' --password '...' URL (or use --netrc so the password is not typed inline).
  2. Verify the same credentials log in at the site in a browser before blaming yt-dlp.
  3. Check shell quoting: single-quote the password; beware trailing spaces and ! history expansion in some shells.
  4. 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.

Example fix

# before (wrong password)
yt-dlp --username me@mail.com --password hunter3 'https://learn.brilliantpala.org/courses/...'
# after
yt-dlp --username me@mail.com --password 'correct horse' 'https://learn.brilliantpala.org/courses/...'
Defensive patterns

Strategy: try-catch

Try / catch

try:
    with YoutubeDL({'username': user, 'password': pw}) as ydl:
        ydl.extract_info(url)
except ExtractorError as e:
    if 'wrong username or password' in str(e):
        raise CredentialsError('brilliantpala login rejected') from e
    raise

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of yt-dlp/yt-dlp@81ecd58b13 (2026-08-22). Data as JSON: /api/errors/b1fea0e01250d28d. Report an issue: GitHub.