soimort/you-get · error · ValueError
Server returned error:%s
Error message
Server returned error:%s
What it means
Raised as ValueError in douyutv_download (src/you_get/extractors/douyutv.py:66). The extractor calls Douyu's private API v1 (room/<id>?aid=wp... with an md5 auth built from a hardcoded key) and checks the 'error' field of the JSON response. Any nonzero value means the API itself rejected the request before room data is usable.
Source
Thrown at src/you_get/extractors/douyutv.py:66
url = re.sub(r'.*douyu.com','https://m.douyu.com/room', url)
html = get_content(url, headers)
room_id_patt = r'"rid"\s*:\s*(\d+),'
room_id = match1(html, room_id_patt)
if room_id == "0":
room_id = url[url.rfind('/') + 1:]
api_url = "http://www.douyutv.com/api/v1/"
args = "room/%s?aid=wp&client_sys=wp&time=%d" % (room_id, int(time.time()))
auth_md5 = (args + "zNzMV1y4EMxOHS6I5WKm").encode("utf-8")
auth_str = hashlib.md5(auth_md5).hexdigest()
json_request_url = "%s%s&auth=%s" % (api_url, args, auth_str)
content = get_content(json_request_url, headers)
json_content = json.loads(content)
data = json_content['data']
server_status = json_content.get('error', 0)
if server_status != 0:
raise ValueError("Server returned error:%s" % server_status)
title = data.get('room_name')
show_status = data.get('show_status')
if show_status != "1":
raise ValueError("The live stream is not online! (Errno:%s)" % server_status)
real_url = data.get('rtmp_url') + '/' + data.get('rtmp_live')
print_info(site_info, title, 'flv', float('inf'))
if not info_only:
download_url_ffmpeg(real_url, title, 'flv', params={}, output_dir=output_dir, merge=merge)
site_info = "douyu.com"
download = douyutv_download
download_playlist = playlist_not_supported('douyu')
View on GitHub (pinned to 049548f3f3)
Solutions
- Confirm the room ID and URL are correct and the room still exists on douyu.com.
- If every room fails, the hardcoded API key/endpoint is outdated — update the auth key and endpoint in douyutv.py or upgrade you-get.
- Inspect the raw JSON (log json_content) to see the specific error code Douyu returns.
Defensive patterns
Strategy: try-catch
Try / catch
try:
douyutv_download(url, output_dir)
except ValueError as e:
if str(e).startswith('Server returned error'):
log_api_rejection(url, e) # likely bad room id or dead API; do not retry
else:
raise Prevention
- Validate the room id is numeric and the room exists before calling.
- Watch for upstream breakage: a hardcoded md5 auth key means the extractor can die site-wide.
When it happens
Trigger: GET of http://www.douyutv.com/api/v1/room/<room_id>?aid=wp&client_sys=wp&time=<ts>&auth=<md5> returns JSON whose 'error' field is nonzero: invalid/nonexistent room_id, or the embedded auth key 'zNzMV1y4EMxOHS6I5WKm' / API contract no longer accepted by Douyu.
Common situations: Room ID parsed from an old-style URL no longer exists; Douyu rotated the API secret or shut down API v1 (it is an undocumented endpoint), making every request fail regardless of room; region blocks returning error JSON.
Related errors
- The live stream is not online! (Errno:%s)
- API returned fail
- Cannot_Get_Play_URL
- Playlist is not supported for
- Share not found or canceled: %s
AI-assisted analysis of soimort/you-get@049548f3f3 (2026-08-15).
Data as JSON: /api/errors/bf1d6c5d72c033b3.
Report an issue: GitHub.