{"record":{"id":"cbc3a44a1be74784","repo":"ytdl-org/youtube-dl","slug":"unable-to-login-s-cbc3a4","errorCode":null,"errorMessage":"Unable to login: %s","messagePattern":"Unable to login: (.+?)","errorType":"exception","errorClass":"ExtractorError","httpStatus":null,"severity":"error","filePath":"youtube_dl/extractor/lynda.py","lineNumber":33,"sourceCode":"\n\nclass LyndaBaseIE(InfoExtractor):\n    _SIGNIN_URL = 'https://www.lynda.com/signin/lynda'\n    _PASSWORD_URL = 'https://www.lynda.com/signin/password'\n    _USER_URL = 'https://www.lynda.com/signin/user'\n    _ACCOUNT_CREDENTIALS_HINT = 'Use --username and --password options to provide lynda.com account credentials.'\n    _NETRC_MACHINE = 'lynda'\n\n    def _real_initialize(self):\n        self._login()\n\n    @staticmethod\n    def _check_error(json_string, key_or_keys):\n        keys = [key_or_keys] if isinstance(key_or_keys, compat_str) else key_or_keys\n        for key in keys:\n            error = json_string.get(key)\n            if error:\n                raise ExtractorError('Unable to login: %s' % error, expected=True)\n\n    def _login_step(self, form_html, fallback_action_url, extra_form_data, note, referrer_url):\n        action_url = self._search_regex(\n            r'<form[^>]+action=([\"\\'])(?P<url>.+?)\\1', form_html,\n            'post url', default=fallback_action_url, group='url')\n\n        if not action_url.startswith('http'):\n            action_url = compat_urlparse.urljoin(self._SIGNIN_URL, action_url)\n\n        form_data = self._hidden_inputs(form_html)\n        form_data.update(extra_form_data)\n\n        response = self._download_json(\n            action_url, None, note,\n            data=urlencode_postdata(form_data),\n            headers={\n                'Referer': referrer_url,\n                'X-Requested-With': 'XMLHttpRequest',","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/ytdl-org/youtube-dl/blob/956b8c585591b401a543e409accb163eeaaa1193/youtube_dl/extractor/lynda.py#L15-L51","documentation":"Thrown during Lynda authentication when a step of the multi-stage login flow returns a JSON body containing an error under one of the watched keys (passed as key_or_keys to _check_error). It is expected=True, so it signals a credential or account problem (bad password, expired account, captcha) rather than an internal failure. The '%s' is the raw error string from lynda.com.","triggerScenarios":"Any _login_step POST whose response JSON contains a truthy value under the checked key(s) (e.g. 'error', 'ErrorMessage') triggers this immediately after the form is submitted with the user's credentials.","commonSituations":"Wrong username/password supplied via --username/--password or .netrc (machine 'lynda'); expired or cancelled Lynda subscription; Lynda login flow changed (new CSRF field, new endpoint) so the parsed response now contains an error blob; forced captcha/2FA on the account.","solutions":["Verify the lynda.com credentials are correct by logging in with a browser.","Provide credentials explicitly: --username and --password, or a netrc entry for machine 'lynda'.","Pass --cookies with an exported browser cookie jar to bypass the form login entirely.","If credentials are valid but the error persists, the login flow likely changed; update youtube-dl (the Lynda extractor is frequently patched) or report an issue."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"# Validate credentials shape before invoking the extractor\nimport getpass, netrc\ntry:\n    n = netrc.netrc()\n    auth = n.authenticators('lynda')\n    ok = bool(auth and auth[0] and auth[2])\nexcept FileNotFoundError:\n    ok = '--username' in sys.argv or False\nassert ok, 'Provide lynda credentials via --username/--password or a netrc entry'","typeGuard":"def has_lynda_credentials(opts):\n    return bool(getattr(opts, 'username', None) and getattr(opts, 'password', None)) or getattr(opts, 'cookiefile', None) is not None","tryCatchPattern":"try:\n    ydl.download([url])\nexcept ExtractorError as e:\n    if 'Unable to login' in str(e):\n        # credentials/account problem: fix inputs, do not retry unchanged\n        print('Check lynda credentials or supply --cookies')\n    else:\n        raise","preventionTips":["Store lynda credentials in a netrc entry (machine lynda) instead of CLI flags.","Prefer --cookies exported from a logged-in browser to sidestep the form-login flow.","Log in manually at lynda.com first to clear captchas/2FA before extracting."],"tags":["authentication","login","credentials","expected-error"],"backgroundTag":null,"analyzedSha":"956b8c585591b401a543e409accb163eeaaa1193","analyzedAt":"2026-08-14T18:59:47.863Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}