ytdl-org/youtube-dl · error · ExtractorError

%s

Error message

%s

What it means

Raised by the LinkedIn login helper when the submitted session_key/session_password form response contains an element matching <span class="error">...</span>; the scraped error text becomes the message. It is expected=True. It fires only when a login was attempted and the page shows an inline error.

Source

Thrown at youtube_dl/extractor/linkedin.py:71

        login_page = self._download_webpage(
            self._LOGIN_URL, None, 'Downloading login page')
        action_url = urljoin(self._LOGIN_URL, self._search_regex(
            r'<form[^>]+action=(["\'])(?P<url>.+?)\1', login_page, 'post url',
            default='https://www.linkedin.com/uas/login-submit', group='url'))
        data = self._hidden_inputs(login_page)
        data.update({
            'session_key': email,
            'session_password': password,
        })
        login_submit_page = self._download_webpage(
            action_url, None, 'Logging in',
            data=urlencode_postdata(data))
        error = self._search_regex(
            r'<span[^>]+class="error"[^>]*>\s*(.+?)\s*</span>',
            login_submit_page, 'error', default=None)
        if error:
            raise ExtractorError(error, expected=True)


class LinkedInLearningIE(LinkedInLearningBaseIE):
    IE_NAME = 'linkedin:learning'
    _VALID_URL = r'https?://(?:www\.)?linkedin\.com/learning/(?P<course_slug>[^/]+)/(?P<id>[^/?#]+)'
    _TEST = {
        'url': 'https://www.linkedin.com/learning/programming-foundations-fundamentals/welcome?autoplay=true',
        'md5': 'a1d74422ff0d5e66a792deb996693167',
        'info_dict': {
            'id': '90426',
            'ext': 'mp4',
            'title': 'Welcome',
            'timestamp': 1430396150.82,
            'upload_date': '20150430',
        },
    }

    def _real_extract(self, url):

View on GitHub (pinned to 956b8c5855)

Solutions

  1. Confirm the credentials work in a normal browser session
  2. Use --cookies / --cookies-from-browser with an already-authenticated browser profile instead of password login
  3. For SSO-only accounts, export session cookies after logging in through your identity provider
  4. Retry from a residential IP if LinkedIn is challenging datacenter logins

Example fix

# before: password login (often challenged)
# youtube-dl -u email -p pass 'https://www.linkedin.com/learning/...'

# after: reuse an authenticated browser session
# yt-dlp --cookies-from-browser firefox 'https://www.linkedin.com/learning/...'
Defensive patterns

Strategy: fallback

Try / catch

try:
    ydl.download([url])
except ExtractorError as e:
    if 'login' in str(e).lower() or 'password' in str(e).lower():
        ydl.cookies.from_browser('firefox')  # fall back to session cookies
        ydl.download([url])
    else:
        raise

Prevention

When it happens

Trigger: Using --username/--password on linkedin.com/learning URLs where the login POST returns a page containing a span with class 'error' — wrong password, unknown email, or LinkedIn challenging the automated login.

Common situations: Invalid or mistyped credentials; LinkedIn adding captcha/2FA/phone-verification to suspicious logins (datacenter IPs, headless clients); LinkedIn changing its login HTML so the error span matches an unrelated element; accounts with mandatory SSO that cannot do password login.

Related errors


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