ytdl-org/youtube-dl · error · ExtractorError

clean_html(error_message)

Error message

clean_html(error_message)

What it means

Raised by TeamTreeHouseIE._login after posting credentials to teamtreehouse.com/person_session: the response contains an element with class 'error-message', whose HTML is cleaned and raised verbatim (expected=True). This is the site telling you why the sign-in failed — typically 'Invalid email or password'.

Source

Thrown at youtube_dl/extractor/teamtreehouse.py:71

    def _real_initialize(self):
        email, password = self._get_login_info()
        if email is None:
            return

        signin_page = self._download_webpage(
            'https://teamtreehouse.com/signin',
            None, 'Downloading signin page')
        data = self._form_hidden_inputs('new_user_session', signin_page)
        data.update({
            'user_session[email]': email,
            'user_session[password]': password,
        })
        error_message = get_element_by_class('error-message', self._download_webpage(
            'https://teamtreehouse.com/person_session',
            None, 'Logging in', data=urlencode_postdata(data)))
        if error_message:
            raise ExtractorError(clean_html(error_message), expected=True)

    def _real_extract(self, url):
        display_id = self._match_id(url)
        webpage = self._download_webpage(url, display_id)
        title = self._html_search_meta(['og:title', 'twitter:title'], webpage)
        description = self._html_search_meta(
            ['description', 'og:description', 'twitter:description'], webpage)
        entries = self._parse_html5_media_entries(url, webpage, display_id)
        if entries:
            info = entries[0]

            for subtitles in info.get('subtitles', {}).values():
                for subtitle in subtitles:
                    subtitle['ext'] = determine_ext(subtitle['url'], 'srt')

            is_preview = 'data-preview="true"' in webpage
            if is_preview:
                self.report_warning(

View on GitHub (pinned to 956b8c5855)

Solutions

  1. Read the cleaned message text — it states the exact refusal reason from Treehouse.
  2. Verify the same credentials work at teamtreehouse.com/signin in a browser; reset the password if not.
  3. Update .netrc with the working credentials (machine teamtreehouse.com).
  4. If the account uses SSO only, log in via browser, export cookies, and pass --cookies instead of CLI login.
Defensive patterns

Strategy: validation

Validate before calling

# Practical pre-check: confirm creds work in a browser; programmatic
# pre-validation is a login attempt itself, so rely on the error text

Try / catch

try:
    ydl.extract_info(url)
except ExtractorError as e:
    if e.expected and 'sign' not in str(e):  # login-stage expected errors
        log.error('Treehouse login refused: %s', str(e))  # site's own message
        prompt_password_reset()
    else:
        raise

Prevention

When it happens

Trigger: Calling the extractor with --username/--password or netrc credentials that Treehouse rejects; the sign-in POST response renders the Rails error-message div.

Common situations: Wrong/stale password; subscription lapsed so login is refused; accounts with SSO login that cannot authenticate via the form; password managers storing outdated netrc lines.

Related errors


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