{"record":{"id":"18a7dcc7eb2b6d6b","repo":"ytdl-org/youtube-dl","slug":"unable-to-log-in-18a7dc","errorCode":null,"errorMessage":"Unable to log in","messagePattern":"Unable to log in","errorType":"exception","errorClass":"ExtractorError","httpStatus":null,"severity":"error","filePath":"youtube_dl/extractor/pornhub.py","lineNumber":118,"sourceCode":"            'https://www.%s/front/authenticate' % host, None,\n            'Logging in to %s' % site,\n            data=urlencode_postdata(login_form),\n            headers={\n                'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',\n                'Referer': login_url,\n                'X-Requested-With': 'XMLHttpRequest',\n            })\n\n        if response.get('success') == '1':\n            self._logged_in = True\n            return\n\n        message = response.get('message')\n        if message is not None:\n            raise ExtractorError(\n                'Unable to login: %s' % message, expected=True)\n\n        raise ExtractorError('Unable to log in')\n\n\nclass PornHubIE(PornHubBaseIE):\n    IE_DESC = 'PornHub and Thumbzilla'\n    _VALID_URL = r'''(?x)\n                    https?://\n                        (?:\n                            (?:[^/]+\\.)?\n                            %s\n                            /(?:(?:view_video\\.php|video/show)\\?viewkey=|embed/)|\n                            (?:www\\.)?thumbzilla\\.com/video/\n                        )\n                        (?P<id>[\\da-z]+)\n                    ''' % PornHubBaseIE._PORNHUB_HOST_RE\n    _TESTS = [{\n        'url': 'http://www.pornhub.com/view_video.php?viewkey=648719015',\n        'md5': 'a6391306d050e4547f62b3f485dd9ba9',\n        'info_dict': {","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/ytdl-org/youtube-dl/blob/956b8c585591b401a543e409accb163eeaaa1193/youtube_dl/extractor/pornhub.py#L100-L136","documentation":"PornHubBaseIE._login raises ExtractorError('Unable to log in') — with no reason text — when the login AJAX response has success != '1' AND the response JSON contains no 'message' key. This is the fallback branch: the site rejected the login but gave no explanation the extractor can surface. It is not marked expected=True, so it presents as an unexpected login failure.","triggerScenarios":"The login endpoint returns JSON like {'success': '0'} with no 'message' field — typically when the response shape changed (new field names), the request was blocked by anti-bot middleware returning a bare failure, or a non-JSON/empty body was parsed into something without 'message'.","commonSituations":"Site-side API changes after a youtube-dl release (response schema drift); WAF/CDN challenges (Cloudflare) intercepting the login POST; expired extractor version; malformed responses from regional mirrors like thumbzilla sharing the login code path.","solutions":["Update youtube-dl / yt-dlp to the latest release — login-response schema changes are among the most frequently patched extractor bugs.","Skip password login entirely and authenticate via browser cookies (--cookies cookies.txt exported after a manual login).","If no login is actually required for the content, drop --username/--password and retry anonymously.","Capture the raw login response (e.g. with a debugging proxy) to see what the site actually returned, and report it upstream if malformed."],"exampleFix":"# before\nyoutube_dl --username me --password secret URL\n\n# after\nyoutube_dl --cookies cookies.txt URL","handlingStrategy":"fallback","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        run_without_credentials(url)  # anonymous attempt","preventionTips":["Update the extractor first — schema drift is the usual cause of the no-message branch.","Keep browser-exported cookies as the primary auth path.","If content needs no login, run anonymously and skip the login path entirely."],"tags":["pornhub","authentication","api-drift","anti-bot"],"backgroundTag":null,"analyzedSha":"956b8c585591b401a543e409accb163eeaaa1193","analyzedAt":"2026-08-14T18:59:47.863Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}