ytdl-org/youtube-dl · error · ExtractorError

Unable to log in

Error message

Unable to log in

What it means

Raised by TeachableBaseIE._login as the final fallback: the login POST returned neither the privacy-policy marker, nor a logged-in session (is_logged false), nor any 'alert' element. Unlike the sibling errors it is NOT marked expected=True, so youtube-dl reports it as an unexpected extractor failure.

Source

Thrown at youtube_dl/extractor/teachable.py:101

                'Referer': login_url,
            })

        if '>I accept the new Privacy Policy<' in response:
            raise ExtractorError(
                'Unable to login: %s asks you to accept new Privacy Policy. '
                'Go to https://%s/ and accept.' % (site, site), expected=True)

        # Successful login
        if is_logged(response):
            self._logged_in = True
            return

        message = get_element_by_class('alert', response)
        if message is not None:
            raise ExtractorError(
                'Unable to login: %s' % clean_html(message), expected=True)

        raise ExtractorError('Unable to log in')


class TeachableIE(TeachableBaseIE):
    _VALID_URL = r'''(?x)
                    (?:
                        %shttps?://(?P<site_t>[^/]+)|
                        https?://(?:www\.)?(?P<site>%s)
                    )
                    /courses/[^/]+/lectures/(?P<id>\d+)
                    ''' % TeachableBaseIE._VALID_URL_SUB_TUPLE

    _TESTS = [{
        'url': 'https://gns3.teachable.com/courses/gns3-certified-associate/lectures/6842364',
        'info_dict': {
            'id': 'untlgzk1v7',
            'ext': 'bin',
            'title': 'Overview',
            'description': 'md5:071463ff08b86c208811130ea1c2464c',

View on GitHub (pinned to 956b8c5855)

Solutions

  1. Open the site's /login in a browser and confirm the login form flow still matches (one-step email/password, no CAPTCHA).
  2. Use browser cookies instead: export cookies.txt for the site and pass --cookies so the extractor skips _login entirely.
  3. Upgrade youtube-dl (or switch to yt-dlp, which maintains the Teachable extractor) — login-flow changes are patched upstream.
  4. If it must work, reproduce the login POST with curl/requests and update the form parsing in _login.

Example fix

# before: rely on CLI credential login
# youtube-dl --username u --password p https://school.teachable.com/courses/x/lectures/1
# after: reuse an authenticated browser session
# 1) log in in the browser, export cookies (cookies.txt)
# youtube-dl --cookies cookies.txt https://school.teachable.com/courses/x/lectures/1
Defensive patterns

Strategy: fallback

Try / catch

try:
    ydl.extract_info(url)
except ExtractorError as e:
    if 'Unable to log in' in str(e):
        # login flow unrecognized: fall back to a browser session
        run_with_cookies(url, 'cookies.txt')
    else:
        raise

Prevention

When it happens

Trigger: The site returns a login response with an unrecognized shape — no alert div, not logged in — e.g. the school changed its login template, returned a CAPTCHA/interstitial, or the POST endpoint moved.

Common situations: Teachable platform updates that alter the login page markup; custom-skinned schools whose login flow differs; bot-protection challenges on the login POST.

Related errors


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