ytdl-org/youtube-dl · error · ExtractorError

Could not extract ptmd_path

Error message

Could not extract ptmd_path

What it means

Raised by the ZDF extractor when neither the 'http://zdf.de/rels/streams/ptmd' key nor the 'ptmd-template' key can be found in the JSON document (neither under t['streams']['default'] nor at the top level of t). Without the ptmd path the extractor cannot fetch the stream metadata, so it aborts.

Source

Thrown at youtube_dl/extractor/zdf.py:265

    }]

    def _extract_entry(self, url, player, content, video_id):
        title = content.get('title') or content['teaserHeadline']

        t = content['mainVideoContent']['http://zdf.de/rels/target']

        def get_ptmd_path(d):
            return (
                d.get('http://zdf.de/rels/streams/ptmd')
                or d.get('http://zdf.de/rels/streams/ptmd-template',
                         '').replace('{playerId}', 'ngplayer_2_4'))

        ptmd_path = get_ptmd_path(try_get(t, lambda x: x['streams']['default'], dict) or {})
        if not ptmd_path:
            ptmd_path = get_ptmd_path(t)

        if not ptmd_path:
            raise ExtractorError('Could not extract ptmd_path')

        info = self._extract_ptmd(
            urljoin(url, ptmd_path), video_id, player['apiToken'], url)

        thumbnails = []
        layouts = try_get(
            content, lambda x: x['teaserImageRef']['layouts'], dict)
        if layouts:
            for layout_key, layout_url in layouts.items():
                layout_url = url_or_none(layout_url)
                if not layout_url:
                    continue
                thumbnail = {
                    'url': layout_url,
                    'format_id': layout_key,
                }
                mobj = re.search(r'(?P<width>\d+)x(?P<height>\d+)', layout_key)
                if mobj:

View on GitHub (pinned to 956b8c5855)

Solutions

  1. Update youtube-dl to the latest version (ZDF API changes are fixed upstream quickly)
  2. Verify the video still plays in a browser at the same URL
  3. If the URL is a show/season page, open it in the browser and copy the URL of a specific episode instead
  4. If it persists on the latest version, report it as a site-bug to the youtube-dl/yt-dlp issue tracker with the URL
Defensive patterns

Strategy: retry

Try / catch

try:
    ydl.download([url])
except ExtractorError as e:
    if 'Could not extract ptmd_path' in str(e):
        upgrade_youtubedl_and_retry_once()  # likely an API layout change
    else:
        raise

Prevention

When it happens

Trigger: Downloading a ZDF/ZDFmediathek URL where the API response for the content lacks stream information: content taken offline, DRM/formats removed, an API layout change by ZDF, or an entry type (e.g. season/show page) that has no direct streams.

Common situations: ZDF changed their JSON API structure (this historically broke yt-dlp/youtube-dl until patched); the video expired and was removed from the mediathek; the URL points to a series instead of a single episode.

Related errors


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