{"record":{"id":"8adfcca52ca27529","repo":"ytdl-org/youtube-dl","slug":"unable-to-log-in-8adfcc","errorCode":null,"errorMessage":"Unable to log in","messagePattern":"Unable to log in","errorType":"exception","errorClass":"ExtractorError","httpStatus":null,"severity":"error","filePath":"youtube_dl/extractor/safari.py","lineNumber":82,"sourceCode":"        credentials = auth.get('credentials')\n        if (not auth.get('logged_in') and not auth.get('redirect_uri')\n                and credentials):\n            raise ExtractorError(\n                'Unable to login: %s' % credentials, expected=True)\n\n        # oreilly serves two same instances of the following cookies\n        # in Set-Cookie header and expects first one to be actually set\n        for cookie in ('groot_sessionid', 'orm-jwt', 'orm-rt'):\n            self._apply_first_set_cookie_header(urlh, cookie)\n\n        _, urlh = self._download_webpage_handle(\n            auth.get('redirect_uri') or next_uri, None, 'Completing login',)\n\n        if is_logged(urlh):\n            self.LOGGED_IN = True\n            return\n\n        raise ExtractorError('Unable to log in')\n\n\nclass SafariIE(SafariBaseIE):\n    IE_NAME = 'safari'\n    IE_DESC = 'safaribooksonline.com online video'\n    _VALID_URL = r'''(?x)\n                        https?://\n                            (?:www\\.)?(?:safaribooksonline|(?:learning\\.)?oreilly)\\.com/\n                            (?:\n                                library/view/[^/]+/(?P<course_id>[^/]+)/(?P<part>[^/?\\#&]+)\\.html|\n                                videos/[^/]+/[^/]+/(?P<reference_id>[^-]+-[^/?\\#&]+)\n                            )\n                    '''\n\n    _TESTS = [{\n        'url': 'https://www.safaribooksonline.com/library/view/hadoop-fundamentals-livelessons/9780133392838/part00.html',\n        'md5': 'dcc5a425e79f2564148652616af1f2a3',\n        'info_dict': {","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/ytdl-org/youtube-dl/blob/956b8c585591b401a543e409accb163eeaaa1193/youtube_dl/extractor/safari.py#L64-L100","documentation":"Raised by the Safari/O'Reilly login helper after the full flow (auth POST, cookie application, redirect completion) when is_logged(urlh) is still false: the sequence completed without an explicit credentials error, but the session is not authenticated. NOT marked expected=True, so it surfaces as an unexpected extraction error.","triggerScenarios":"Passing --username/--password where the auth succeeds at HTTP level but the final next_uri page does not show a logged-in state - cookie handling breaks (the code applies only the FIRST Set-Cookie instance for groot_sessionid/orm-jwt/orm-rt), or O'Reilly changed its login flow/cookies.","commonSituations":"Site-side login flow changes after an O'Reilly deploy; two-instance Set-Cookie behavior changing; MFA/SSO accounts that cannot complete a plain password POST.","solutions":["Update youtube-dl to the latest version - login-flow breakage is usually fixed upstream quickly.","Confirm the account can log in on the web with the same password (rules out MFA/lockout).","If you do not actually need member content, run without --username/--password for public chapters.","If it persists, report the regression with a trace; the is_logged probe or cookie names likely changed."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    ydl.extract_info(url)\nexcept ExtractorError as e:\n    if 'Unable to log in' in str(e):\n        # not expected=True: usually a site-flow change; retry after updating\n        update_and_retry_once()\n    else:\n        raise","preventionTips":["Keep youtube-dl current - O'Reilly login flow changes frequently and fixes land upstream fast.","Confirm the account can complete plain password login on the web (no MFA challenge).","Run without credentials for public chapters to isolate whether login is the failing step."],"tags":["safari","oreilly","login","session","regression"],"backgroundTag":null,"analyzedSha":"956b8c585591b401a543e409accb163eeaaa1193","analyzedAt":"2026-08-14T18:59:47.863Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}