ytdl-org/youtube-dl · error · ExtractorError
Unable to login: %s
Error message
Unable to login: %s
What it means
PornHubBaseIE._login raises ExtractorError('Unable to login: %s' % message, expected=True) when the AJAX POST to the login endpoint returns JSON with success != '1' but includes a 'message' field. The interpolated text is the site's own failure reason (e.g. wrong username/password or CAPTCHA required). Expected=True makes it a reportable credential problem rather than an extractor crash.
Source
Thrown at youtube_dl/extractor/pornhub.py:115
})
response = self._download_json(
'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 = [{View on GitHub (pinned to 956b8c5855)
Solutions
- Verify the username/password pair logs in successfully in a normal browser session.
- If the message indicates a CAPTCHA, log in manually once in a browser and pass cookies (--cookies from a cookies.txt) instead of username/password.
- Check the exact site message in the error text — it names the real failure (bad credentials, locked account, etc.).
- Update youtube-dl, as login endpoint/parameter changes are fixed in newer releases.
Example fix
# before youtube_dl --username me --password 'typo' URL # after # export browser cookies and skip password login youtube_dl --cookies cookies.txt URL
Defensive patterns
Strategy: try-catch
Try / catch
try:
ydl.extract_info(url)
except ExtractorError as e:
if str(e).startswith('Unable to login:'):
# fall back to cookie-based auth
... Prevention
- Prefer --cookies from a real browser session over username/password for this site.
- Never hard-code credentials; read them from a secret store and verify in a browser first.
- Watch the message text — it names the actual cause (bad password vs CAPTCHA).
When it happens
Trigger: Running with --username/--password where the credentials are wrong or the account requires a CAPTCHA; the POST to login_url with X-Requested-With/Referer headers returns {'success': '0', 'message': '...'}; partial two-factor or locked accounts also return here.
Common situations: Typo'd or expired passwords; PornHub intermittently requiring reCAPTCHA on API logins (which the extractor cannot solve); account locked/flagged; password managers inserting stale credentials; too many login attempts triggering anti-bot.
Related errors
- 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
- Unable to login: %s
- Unable to login: %s
AI-assisted analysis of ytdl-org/youtube-dl@956b8c5855 (2026-08-14).
Data as JSON: /api/errors/88bb3b14ef89bbf2.
Report an issue: GitHub.