soimort/you-get · error · AssertionError
Server returned an error: %s (Incorrect password?)
Error message
Server returned an error: %s (Incorrect password?)
What it means
Raised as AssertionError inside baidu_pan_protected_share (src/you_get/extractors/baidu.py:293). This function verifies the share password by POSTing to Baidu's verify endpoint; a nonzero errno in the JSON response means the password was rejected (or the verify request itself was malformed), so the code aborts with '(Incorrect password?)'.
Source
Thrown at src/you_get/extractors/baidu.py:293
init_url.split('?', 1)[1], int(time.time()))
refer_url = init_url
fake_headers = {
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'Accept-Charset': 'UTF-8,*;q=0.5',
'Accept-Encoding': 'gzip,deflate,sdch',
'Accept-Language': 'en-US,en;q=0.8',
'Host': 'pan.baidu.com',
'Origin': 'http://pan.baidu.com',
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:13.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2500.0 Safari/537.36',
'Referer': refer_url
}
opener.addheaders = dict2triplet(fake_headers)
pwd_resp = opener.open(verify_url, bytes(
parse.urlencode(post_pwd), 'utf-8'))
pwd_resp_str = ungzip(pwd_resp.read()).decode('utf-8')
pwd_res = json.loads(pwd_resp_str)
if pwd_res['errno'] != 0:
raise AssertionError(
'Server returned an error: %s (Incorrect password?)' % pwd_res['errno'])
pg_resp = opener.open('http://pan.baidu.com/share/link?%s' %
init_url.split('?', 1)[1])
content = ungzip(pg_resp.read()).decode('utf-8')
sign, timestamp, bdstoken, appid, primary_id, fs_id, uk = baidu_pan_parse(
content)
psk = query_cookiejar(cookiejar, 'BDCLND')
psk = parse.unquote(psk)
fake_headers['Cookie'] = cookjar2hdr(cookiejar)
return sign, timestamp, bdstoken, appid, primary_id, fs_id, uk, fake_headers, psk
def cookjar2hdr(cookiejar):
cookie_str = ''
for i in cookiejar:
cookie_str = cookie_str + i.name + '=' + i.value + ';'
return cookie_str[:-1]
View on GitHub (pinned to 049548f3f3)
Solutions
- Double-check and re-enter the correct share password.
- Confirm the password manually on pan.baidu.com in a browser for the same URL; if the browser also fails, the share/password pair is wrong.
- If the password is right but it still fails, Baidu likely added extra verification — update baidu_pan_protected_share or upgrade you-get.
Defensive patterns
Strategy: try-catch
Try / catch
try:
baidu_pan_download(url, password=pwd)
except AssertionError as e:
if 'Incorrect password' in str(e):
pwd = prompt_user_for_password(url) # re-ask, never loop blindly
else:
raise Prevention
- Confirm the password in a browser before automating.
- Treat repeated failures as captcha/verification issues, not retryable ones.
When it happens
Trigger: Calling baidu_pan_download on a password-protected pan.baidu.com share where the supplied password is wrong: the POST to the verify URL returns JSON with errno != 0. Also triggered when the verify endpoint response format changes and errno is nonzero/unexpected.
Common situations: Typo in the share password; stale password copied from an old post; Baidu adding extra captcha/verification the script cannot satisfy, surfacing as a nonzero errno.
Related errors
- Share not found or canceled: %s
- Playlist is not supported for
- Server refused to provide download link! (Errno:%s)
- Server returned error:%s
- The live stream is not online! (Errno:%s)
AI-assisted analysis of soimort/you-get@049548f3f3 (2026-08-15).
Data as JSON: /api/errors/23ccfc074defa422.
Report an issue: GitHub.