ytdl-org/youtube-dl · error · ExtractorError

Unable to extract media URL

Error message

Unable to extract media URL

What it means

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.

Source

Thrown at youtube_dl/extractor/metacafe.py:194

            mobj = re.search(r'(?m)&gdaKey=(.*?)&', webpage)
            if mobj is None:
                video_url = mediaURL
            else:
                gdaKey = mobj.group(1)
                video_url = '%s?__gda__=%s' % (mediaURL, gdaKey)
        if video_url is None:
            mobj = re.search(r'<video src="([^"]+)"', webpage)
            if mobj:
                video_url = mobj.group(1)
                video_ext = 'mp4'
        if video_url is None:
            flashvars = self._search_regex(
                r' name="flashvars" value="(.*?)"', webpage, 'flashvars',
                default=None)
            if flashvars:
                vardict = compat_parse_qs(flashvars)
                if 'mediaData' not in vardict:
                    raise ExtractorError('Unable to extract media URL')
                mobj = re.search(
                    r'"mediaURL":"(?P<mediaURL>http.*?)",(.*?)"key":"(?P<key>.*?)"', vardict['mediaData'][0])
                if mobj is None:
                    raise ExtractorError('Unable to extract media URL')
                mediaURL = mobj.group('mediaURL').replace('\\/', '/')
                video_url = '%s?__gda__=%s' % (mediaURL, mobj.group('key'))
                video_ext = determine_ext(video_url)
        if video_url is None:
            player_url = self._search_regex(
                r"swfobject\.embedSWF\('([^']+)'",
                webpage, 'config URL', default=None)
            if player_url:
                config_url = self._search_regex(
                    r'config=(.+)$', player_url, 'config URL')
                config_doc = self._download_xml(
                    config_url, video_id,
                    note='Downloading video config')
                smil_url = config_doc.find('.//properties').attrib['smil_file']

View on GitHub (pinned to 956b8c5855)

Solutions

  1. Update youtube-dl / yt-dlp — Metacafe page structure changes are fixed in newer releases.
  2. Run with -v to see which of the URL-probing branches executed and dump the flashvars content.
  3. Try the alternate URL form (adding a family-friendly or byId variant) in case the canonical page renders differently.
  4. If reproducible, report the URL to the issue tracker so the flashvars parsing can be adjusted.
Defensive patterns

Strategy: fallback

Validate before calling

# Pre-flight: confirm the page carries a known media marker
import urllib.request
html = urllib.request.urlopen(url).read().decode('utf-8', 'replace')
assert ('mediaURL=' in html or '<video src=' in html or 'mediaData' in html), 'No known Metacafe media marker'

Type guard

def flashvars_has_mediadata(vardict):
    return isinstance(vardict, dict) and 'mediaData' in vardict

Try / catch

try:
    info = ydl.extract_info(url, download=False)
except ExtractorError as e:
    if 'Unable to extract media URL' in str(e):
        try_alternative_extractor_or_manual_download(url)  # page shape changed; fall back
    else:
        raise

Prevention

When it happens

Trigger: Webpage has neither (?m)&mediaURL= / &videoURL= nor a <video src="..."> tag, but does contain name="flashvars" value="..."; the parsed flashvars dict lacks 'mediaData'.

Common situations: 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.

Related errors


AI-assisted analysis of ytdl-org/youtube-dl@956b8c5855 (2026-08-14). Data as JSON: /api/errors/ea8a95a390c656fb. Report an issue: GitHub.