ytdl-org/youtube-dl · error · ExtractorError
Unable to log in
Error message
Unable to log in
What it means
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.
Source
Thrown at youtube_dl/extractor/pornhub.py:118
'https://www.%s/front/authenticate' % host, None,
'Logging in to %s' % site,
data=urlencode_postdata(login_form),
headers={
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'Referer': login_url,
'X-Requested-With': 'XMLHttpRequest',
})
if response.get('success') == '1':
self._logged_in = True
return
message = response.get('message')
if message is not None:
raise ExtractorError(
'Unable to login: %s' % message, expected=True)
raise ExtractorError('Unable to log in')
class PornHubIE(PornHubBaseIE):
IE_DESC = 'PornHub and Thumbzilla'
_VALID_URL = r'''(?x)
https?://
(?:
(?:[^/]+\.)?
%s
/(?:(?:view_video\.php|video/show)\?viewkey=|embed/)|
(?:www\.)?thumbzilla\.com/video/
)
(?P<id>[\da-z]+)
''' % PornHubBaseIE._PORNHUB_HOST_RE
_TESTS = [{
'url': 'http://www.pornhub.com/view_video.php?viewkey=648719015',
'md5': 'a6391306d050e4547f62b3f485dd9ba9',
'info_dict': {View on GitHub (pinned to 956b8c5855)
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.
Example fix
# before youtube_dl --username me --password secret URL # after youtube_dl --cookies cookies.txt URL
Defensive patterns
Strategy: fallback
Try / catch
try:
ydl.extract_info(url)
except ExtractorError as e:
if 'Unable to log in' in str(e):
run_without_credentials(url) # anonymous attempt Prevention
- 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.
When it happens
Trigger: 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'.
Common situations: 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.
Related errors
- Unable to login: %s
- No such Python version: %s
- This video is only available for users of participating TV p
- We're sorry, but either the User ID or Password entered is n
- Unable to login: %s said: %s
AI-assisted analysis of ytdl-org/youtube-dl@956b8c5855 (2026-08-14).
Data as JSON: /api/errors/18a7dcc7eb2b6d6b.
Report an issue: GitHub.