ytdl-org/youtube-dl · error · ExtractorError
%s returned error code %d
Error message
%s returned error code %d
What it means
Raised by the RTVNH (Dutch regional broadcaster) extractor when the JSON from rtvnh.nl/video/json?m=<id> has a 'status' field other than 200 - the site's own envelope reports the failure, and the message interpolates that numeric code (e.g. 'RTVNH returned error code 404'). Expected=True.
Source
Thrown at youtube_dl/extractor/rtvnh.py:29
'url': 'http://www.rtvnh.nl/video/131946',
'md5': 'cdbec9f44550763c8afc96050fa747dc',
'info_dict': {
'id': '131946',
'ext': 'mp4',
'title': 'Grote zoektocht in zee bij Zandvoort naar vermiste vrouw',
'thumbnail': r're:^https?:.*\.jpg$'
}
}
def _real_extract(self, url):
video_id = self._match_id(url)
meta = self._parse_json(self._download_webpage(
'http://www.rtvnh.nl/video/json?m=' + video_id, video_id), video_id)
status = meta.get('status')
if status != 200:
raise ExtractorError(
'%s returned error code %d' % (self.IE_NAME, status), expected=True)
formats = []
rtmp_formats = self._extract_smil_formats(
'http://www.rtvnh.nl/video/smil?m=' + video_id, video_id)
formats.extend(rtmp_formats)
for rtmp_format in rtmp_formats:
rtmp_url = '%s/%s' % (rtmp_format['url'], rtmp_format['play_path'])
rtsp_format = rtmp_format.copy()
del rtsp_format['play_path']
del rtsp_format['ext']
rtsp_format.update({
'format_id': rtmp_format['format_id'].replace('rtmp', 'rtsp'),
'url': rtmp_url.replace('rtmp://', 'rtsp://'),
'protocol': 'rtsp',
})
formats.append(rtsp_format)View on GitHub (pinned to 956b8c5855)
Solutions
- Check the numeric code: 404-like codes mean the clip is gone; 5xx codes mean retry later.
- Confirm the video on rtvnh.nl in a browser.
- For batch jobs, probe the JSON endpoint and skip non-200 statuses (see validation below).
- If the site was migrated (rtvnh merged into omroepwest/omroepbrabant brands), find the new URL.
Defensive patterns
Strategy: validation
Validate before calling
import json, urllib.request
def rtvnh_ok(video_id):
with urllib.request.urlopen('http://www.rtvnh.nl/video/json?m=' + video_id, timeout=10) as r:
return json.load(r).get('status') == 200 Try / catch
try:
ydl.extract_info(url)
except ExtractorError as e:
if 'returned error code' in str(e):
code = int(str(e).rsplit(' ', 1)[1])
if code >= 500: retry_later(url)
else: drop(url)
else:
raise Prevention
- Probe the JSON status envelope before queuing (code above).
- Classify 5xx statuses as transient and 4xx-ish as permanent.
- RTVNH content is regional news with short retention - download promptly.
When it happens
Trigger: Extracting any rtvnh.nl video id whose JSON endpoint sets status != 200: unknown id, removed news clips, or server-side errors (500 in the status field).
Common situations: Dead local-news links after clips expire from the CMS; scraped ids that were never valid.
Related errors
AI-assisted analysis of ytdl-org/youtube-dl@956b8c5855 (2026-08-14).
Data as JSON: /api/errors/d41162d30c03ab44.
Report an issue: GitHub.