{"record":{"id":"d41162d30c03ab44","repo":"ytdl-org/youtube-dl","slug":"s-returned-error-code-d","errorCode":null,"errorMessage":"%s returned error code %d","messagePattern":"(.+?) returned error code (.+?)","errorType":"exception","errorClass":"ExtractorError","httpStatus":null,"severity":"error","filePath":"youtube_dl/extractor/rtvnh.py","lineNumber":29,"sourceCode":"        'url': 'http://www.rtvnh.nl/video/131946',\n        'md5': 'cdbec9f44550763c8afc96050fa747dc',\n        'info_dict': {\n            'id': '131946',\n            'ext': 'mp4',\n            'title': 'Grote zoektocht in zee bij Zandvoort naar vermiste vrouw',\n            'thumbnail': r're:^https?:.*\\.jpg$'\n        }\n    }\n\n    def _real_extract(self, url):\n        video_id = self._match_id(url)\n\n        meta = self._parse_json(self._download_webpage(\n            'http://www.rtvnh.nl/video/json?m=' + video_id, video_id), video_id)\n\n        status = meta.get('status')\n        if status != 200:\n            raise ExtractorError(\n                '%s returned error code %d' % (self.IE_NAME, status), expected=True)\n\n        formats = []\n        rtmp_formats = self._extract_smil_formats(\n            'http://www.rtvnh.nl/video/smil?m=' + video_id, video_id)\n        formats.extend(rtmp_formats)\n\n        for rtmp_format in rtmp_formats:\n            rtmp_url = '%s/%s' % (rtmp_format['url'], rtmp_format['play_path'])\n            rtsp_format = rtmp_format.copy()\n            del rtsp_format['play_path']\n            del rtsp_format['ext']\n            rtsp_format.update({\n                'format_id': rtmp_format['format_id'].replace('rtmp', 'rtsp'),\n                'url': rtmp_url.replace('rtmp://', 'rtsp://'),\n                'protocol': 'rtsp',\n            })\n            formats.append(rtsp_format)","sourceCodeStart":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/ytdl-org/youtube-dl/blob/956b8c585591b401a543e409accb163eeaaa1193/youtube_dl/extractor/rtvnh.py#L11-L47","documentation":"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.","triggerScenarios":"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).","commonSituations":"Dead local-news links after clips expire from the CMS; scraped ids that were never valid.","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."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import json, urllib.request\ndef rtvnh_ok(video_id):\n    with urllib.request.urlopen('http://www.rtvnh.nl/video/json?m=' + video_id, timeout=10) as r:\n        return json.load(r).get('status') == 200","typeGuard":null,"tryCatchPattern":"try:\n    ydl.extract_info(url)\nexcept ExtractorError as e:\n    if 'returned error code' in str(e):\n        code = int(str(e).rsplit(' ', 1)[1])\n        if code >= 500: retry_later(url)\n        else: drop(url)\n    else:\n        raise","preventionTips":["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."],"tags":["rtvnh","status-code","site-error","expected-error"],"backgroundTag":null,"analyzedSha":"956b8c585591b401a543e409accb163eeaaa1193","analyzedAt":"2026-08-14T18:59:47.863Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}