{"record":{"id":"a11fbafbbf0d7df9","repo":"ytdl-org/youtube-dl","slug":"unable-to-login-s-a11fba","errorCode":null,"errorMessage":"Unable to login: %s","messagePattern":"Unable to login: (.+?)","errorType":"exception","errorClass":"ExtractorError","httpStatus":null,"severity":"error","filePath":"youtube_dl/extractor/frontendmasters.py","lineNumber":69,"sourceCode":"            'post_url', default=self._LOGIN_URL, group='url')\n\n        if not post_url.startswith('http'):\n            post_url = compat_urlparse.urljoin(self._LOGIN_URL, post_url)\n\n        response = self._download_webpage(\n            post_url, None, 'Logging in', data=urlencode_postdata(login_form),\n            headers={'Content-Type': 'application/x-www-form-urlencoded'})\n\n        # Successful login\n        if any(p in response for p in (\n                'wp-login.php?action=logout', '>Logout')):\n            return\n\n        error = self._html_search_regex(\n            r'class=([\"\\'])(?:(?!\\1).)*\\bMessageAlert\\b(?:(?!\\1).)*\\1[^>]*>(?P<error>[^<]+)<',\n            response, 'error message', default=None, group='error')\n        if error:\n            raise ExtractorError('Unable to login: %s' % error, expected=True)\n        raise ExtractorError('Unable to log in')\n\n\nclass FrontendMastersPageBaseIE(FrontendMastersBaseIE):\n    def _download_course(self, course_name, url):\n        return self._download_json(\n            '%s/courses/%s' % (self._API_BASE, course_name), course_name,\n            'Downloading course JSON', headers={'Referer': url})\n\n    @staticmethod\n    def _extract_chapters(course):\n        chapters = []\n        lesson_elements = course.get('lessonElements')\n        if isinstance(lesson_elements, list):\n            chapters = [url_or_none(e) for e in lesson_elements if url_or_none(e)]\n        return chapters\n\n    @staticmethod","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/ytdl-org/youtube-dl/blob/956b8c585591b401a543e409accb163eeaaa1193/youtube_dl/extractor/frontendmasters.py#L51-L87","documentation":"Raised by FrontendMastersBaseIE._login when the POST of the WordPress login form succeeds HTTP-wise but the response contains neither the logout marker nor a parseable MessageAlert error. The '%s' variant appears when an error banner WAS found; a separate bare 'Unable to log in' covers the unparseable case. Expected=True variant means bad credentials or an account issue surfaced by the site.","triggerScenarios":"The login response lacks 'wp-login.php?action=logout' and '>Logout', and the regex class=\"...MessageAlert...\">(?P<error>...)< matches — the site displayed an error such as 'Invalid username' or 'incorrect password'. Occurs with wrong --username/--password or an account without an active FrontendMasters subscription.","commonSituations":"Typo'd credentials in CI configs; expired subscription accounts; password changes not reflected in stored CLI options; 2FA/captcha interstitials that look like login failures to the regex.","solutions":["Verify the exact username/password by logging in at frontendmasters.com in a browser","Ensure the account has an active subscription (free accounts cannot download course videos)","Quote credentials properly on the command line to avoid shell mangling of special characters","If the site now requires captcha/2FA, log in via browser and use --cookies instead of --username/--password"],"exampleFix":"# before\nyoutube_dl --username me@example.com --password 'wronpw' 'https://frontendmasters.com/courses/x/'\n# ERROR: Unable to login: Invalid username or password\n\n# after\nyt-dlp --username me@example.com --password 'correctpw' 'https://frontendmasters.com/courses/x/'\n# or\nyt-dlp --cookies fm_cookies.txt 'https://frontendmasters.com/courses/x/'","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    ydl.extract_info(url)\nexcept ExtractorError as e:\n    if 'Unable to login' in str(e):\n        alert_credentials_invalid(e)  # check --username/--password; do not loop retries","preventionTips":["Store FrontendMasters credentials in netrc to avoid shell-quoting mistakes","If 2FA/captcha blocks password login, switch to --cookies from a browser session"],"tags":["frontendmasters","extractor","authentication","login-failed"],"backgroundTag":null,"analyzedSha":"956b8c585591b401a543e409accb163eeaaa1193","analyzedAt":"2026-08-14T18:59:47.863Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}