ytdl-org/youtube-dl · error · ExtractorError

Unable to login: %s

Error message

Unable to login: %s

What it means

Raised by Platzi's login flow (_perform_login on the newer API path) when the post-login page's embedded 'login = {...}' JSON contains an error field. The extractor scrapes login_error content via _webpage_read_content, parses the JSON, and for kinds 'error', 'password', 'nonFields' re-raises the site's message as 'Unable to login: <error>' (expected).

Source

Thrown at youtube_dl/extractor/platzi.py:63

            data=urlencode_postdata(login_form),
            headers={'Referer': self._LOGIN_URL})

        # login succeeded
        if 'platzi.com/login' not in urlh.geturl():
            return

        login_error = self._webpage_read_content(
            urlh, self._LOGIN_URL, None, 'Downloading login error page')

        login = self._parse_json(
            self._search_regex(
                r'login\s*=\s*({.+?})(?:\s*;|\s*</script)', login_error, 'login'),
            None)

        for kind in ('error', 'password', 'nonFields'):
            error = str_or_none(login.get('%sError' % kind))
            if error:
                raise ExtractorError(
                    'Unable to login: %s' % error, expected=True)
        raise ExtractorError('Unable to log in')


class PlatziIE(PlatziBaseIE):
    _VALID_URL = r'''(?x)
                    https?://
                        (?:
                            platzi\.com/clases|           # es version
                            courses\.platzi\.com/classes  # en version
                        )/[^/]+/(?P<id>\d+)-[^/?\#&]+
                    '''

    _TESTS = [{
        'url': 'https://platzi.com/clases/1311-next-js/12074-creando-nuestra-primera-pagina/',
        'md5': '8f56448241005b561c10f11a595b37e3',
        'info_dict': {
            'id': '12074',

View on GitHub (pinned to 956b8c5855)

Solutions

  1. Reset/verify the Platzi password at platzi.com, then update --username/--password or .netrc
  2. If the account uses social login only, create a native password in account settings first
  3. Some Platzi content is free — try without credentials to see if login is needed at all
Defensive patterns

Strategy: validation

Validate before calling

# Smoke-test the credential before a batch run
youtube_dl --username "$PS_USER" --password "$PS_PASS" --simulate 'https://platzi.com/clases/test/1234-test/' || echo 'fix credentials first'

Try / catch

try:
    ydl.extract_info(url)
except ExtractorError as e:
    if e.expected and str(e).startswith('Unable to login:'):
        sys.exit('Platzi credentials rejected: ' + str(e))

Prevention

When it happens

Trigger: Logging in with credentials that Platzi rejects: wrong password (passwordError), invalid email/credentials (error), or form-level errors (nonFields). Occurs only when username/password authentication is attempted.

Common situations: Stale .netrc credentials; accounts registered via Google/OAuth only (no native password set); Platzi changing their login page so the login JSON regex fails (then you get a different 'login' search error).

Related errors


AI-assisted analysis of ytdl-org/youtube-dl@956b8c5855 (2026-08-14). Data as JSON: /api/errors/c5e3acf9e8b3fcba. Report an issue: GitHub.