{"record":{"id":"ea8a95a390c656fb","repo":"ytdl-org/youtube-dl","slug":"unable-to-extract-media-url","errorCode":null,"errorMessage":"Unable to extract media URL","messagePattern":"Unable to extract media URL","errorType":"exception","errorClass":"ExtractorError","httpStatus":null,"severity":"error","filePath":"youtube_dl/extractor/metacafe.py","lineNumber":194,"sourceCode":"            mobj = re.search(r'(?m)&gdaKey=(.*?)&', webpage)\n            if mobj is None:\n                video_url = mediaURL\n            else:\n                gdaKey = mobj.group(1)\n                video_url = '%s?__gda__=%s' % (mediaURL, gdaKey)\n        if video_url is None:\n            mobj = re.search(r'<video src=\"([^\"]+)\"', webpage)\n            if mobj:\n                video_url = mobj.group(1)\n                video_ext = 'mp4'\n        if video_url is None:\n            flashvars = self._search_regex(\n                r' name=\"flashvars\" value=\"(.*?)\"', webpage, 'flashvars',\n                default=None)\n            if flashvars:\n                vardict = compat_parse_qs(flashvars)\n                if 'mediaData' not in vardict:\n                    raise ExtractorError('Unable to extract media URL')\n                mobj = re.search(\n                    r'\"mediaURL\":\"(?P<mediaURL>http.*?)\",(.*?)\"key\":\"(?P<key>.*?)\"', vardict['mediaData'][0])\n                if mobj is None:\n                    raise ExtractorError('Unable to extract media URL')\n                mediaURL = mobj.group('mediaURL').replace('\\\\/', '/')\n                video_url = '%s?__gda__=%s' % (mediaURL, mobj.group('key'))\n                video_ext = determine_ext(video_url)\n        if video_url is None:\n            player_url = self._search_regex(\n                r\"swfobject\\.embedSWF\\('([^']+)'\",\n                webpage, 'config URL', default=None)\n            if player_url:\n                config_url = self._search_regex(\n                    r'config=(.+)$', player_url, 'config URL')\n                config_doc = self._download_xml(\n                    config_url, video_id,\n                    note='Downloading video config')\n                smil_url = config_doc.find('.//properties').attrib['smil_file']","sourceCodeStart":176,"sourceCodeEnd":212,"githubUrl":"https://github.com/ytdl-org/youtube-dl/blob/956b8c585591b401a543e409accb163eeaaa1193/youtube_dl/extractor/metacafe.py#L176-L212","documentation":"Raised by the Metacafe extractor during URL discovery: earlier probes (mediaURL query param, <video src> tag) found nothing, a flashvars parameter string exists, but parsing it with compat_parse_qs yields no 'mediaData' key. Not expected=True, so it surfaces as an extraction failure.","triggerScenarios":"Webpage has neither (?m)&mediaURL= / &videoURL= nor a <video src=\"...\"> tag, but does contain name=\"flashvars\" value=\"...\"; the parsed flashvars dict lacks 'mediaData'.","commonSituations":"Metacafe changed its flash player embedding (renamed the flashvars key); the video page is a redirect/login shell with placeholder flashvars; very old or very new page templates that never carried mediaData.","solutions":["Update youtube-dl / yt-dlp — Metacafe page structure changes are fixed in newer releases.","Run with -v to see which of the URL-probing branches executed and dump the flashvars content.","Try the alternate URL form (adding a family-friendly or byId variant) in case the canonical page renders differently.","If reproducible, report the URL to the issue tracker so the flashvars parsing can be adjusted."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"# Pre-flight: confirm the page carries a known media marker\nimport urllib.request\nhtml = urllib.request.urlopen(url).read().decode('utf-8', 'replace')\nassert ('mediaURL=' in html or '<video src=' in html or 'mediaData' in html), 'No known Metacafe media marker'","typeGuard":"def flashvars_has_mediadata(vardict):\n    return isinstance(vardict, dict) and 'mediaData' in vardict","tryCatchPattern":"try:\n    info = ydl.extract_info(url, download=False)\nexcept ExtractorError as e:\n    if 'Unable to extract media URL' in str(e):\n        try_alternative_extractor_or_manual_download(url)  # page shape changed; fall back\n    else:\n        raise","preventionTips":["Keep the extractor version current; Metacafe embedding has changed repeatedly.","Capture page HTML at failure time (-v) so scrape breakage can be diagnosed in one pass."],"tags":["flashvars","scrape-failure","metacafe"],"backgroundTag":null,"analyzedSha":"956b8c585591b401a543e409accb163eeaaa1193","analyzedAt":"2026-08-14T18:59:47.863Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}