{"record":{"id":"aa6efa4e21422515","repo":"ytdl-org/youtube-dl","slug":"not-a-media-file","errorCode":null,"errorMessage":"not a media file","messagePattern":"not a media file","errorType":"exception","errorClass":"ExtractorError","httpStatus":null,"severity":"error","filePath":"youtube_dl/extractor/rai.py","lineNumber":502,"sourceCode":"        media = self._download_json(\n            'http://www.rai.tv/dl/RaiTV/programmi/media/ContentItem-%s.html?json' % content_id,\n            content_id, 'Downloading video JSON')\n\n        title = media['name'].strip()\n\n        media_type = media['type']\n        if 'Audio' in media_type:\n            relinker_info = {\n                'formats': [{\n                    'format_id': media.get('formatoAudio'),\n                    'url': media['audioUrl'],\n                    'ext': media.get('formatoAudio'),\n                }]\n            }\n        elif 'Video' in media_type:\n            relinker_info = self._extract_relinker_info(media['mediaUri'], content_id)\n        else:\n            raise ExtractorError('not a media file')\n\n        self._sort_formats(relinker_info['formats'])\n\n        thumbnails = []\n        for image_type in ('image', 'image_medium', 'image_300'):\n            thumbnail_url = media.get(image_type)\n            if thumbnail_url:\n                thumbnails.append({\n                    'url': compat_urlparse.urljoin(url, thumbnail_url),\n                })\n\n        subtitles = self._extract_subtitles(url, media)\n\n        info = {\n            'id': content_id,\n            'title': title,\n            'description': strip_or_none(media.get('desc')),\n            'thumbnails': thumbnails,","sourceCodeStart":484,"sourceCodeEnd":520,"githubUrl":"https://github.com/ytdl-org/youtube-dl/blob/956b8c585591b401a543e409accb163eeaaa1193/youtube_dl/extractor/rai.py#L484-L520","documentation":"RaiIE (the older link-resolver path, around line 502) inspects media['type'] from the resolved media JSON: if it contains 'Audio' it builds an audio format, if it contains 'Video' it uses _extract_relinker_info, otherwise it raises ExtractorError('not a media file'). The check is substring-based ('Audio' in media_type / 'Video' in media_type), so any other type value — e.g. an article, image gallery, or new content type — falls through. Not marked expected=True.","triggerScenarios":"The media JSON for the resolved id has a 'type' field containing neither 'Audio' nor 'Video' (e.g. 'photo', 'article', 'page'); typically reached when a content id resolves to a non-media resource or the resolver returns an unexpected payload shape.","commonSituations":"Urls for Rai news articles or photo pages rather than media pages; API changes introducing new type strings; id mix-ups where an article id is passed to the media resolver.","solutions":["Make sure the URL points to an actual audio/video page on Rai, not an article or gallery.","Update youtube-dl — new media types and resolver changes get patched in extractor updates.","Inspect media['type'] for your id (download the resolved JSON) to see what the API thinks the content is.","Pick the canonical media page URL from the Rai site UI and retry."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"# Pre-check the media type when you have the resolved JSON\nis_media = ('Audio' in media.get('type', '')) or ('Video' in media.get('type', ''))","typeGuard":"def is_media_payload(media: dict) -> bool:\n    t = media.get('type') or ''\n    return 'Audio' in t or 'Video' in t","tryCatchPattern":"try:\n    info = ydl.extract_info(url)\nexcept ExtractorError as e:\n    if 'not a media file' in str(e):\n        find_media_page_url(url)","preventionTips":["Queue only media (audio/video) page URLs, not articles or galleries.","Update the extractor when Rai adds new type strings.","Inspect the resolved JSON's type field when triaging unexpected failures."],"tags":["rai","media-type","dispatch","non-media-content"],"backgroundTag":null,"analyzedSha":"956b8c585591b401a543e409accb163eeaaa1193","analyzedAt":"2026-08-14T18:59:47.863Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}