ytdl-org/youtube-dl · error · ExtractorError

Cannot parse data

Error message

Cannot parse data

What it means

Raised by the Facebook extractor as a last resort after every extraction path fails: the HTML video_data search, the GraphQL/attachment parsing, the watchparty API, and the tahoe JS data all returned nothing usable. 'Cannot parse data' means the extractor could not locate any embedded video metadata on the page, usually because Facebook changed its markup or served a login/consent wall. It is NOT marked expected, so it often indicates an extractor that is out of date.

Source

Thrown at youtube_dl/extractor/facebook.py:594

                    '__rev': self._search_regex(
                        r'client_revision["\']\s*:\s*(\d+),', webpage,
                        'client revision', default='3944515'),
                    'fb_dtsg': self._search_regex(
                        r'"DTSGInitialData"\s*,\s*\[\]\s*,\s*{\s*"token"\s*:\s*"([^"]+)"',
                        webpage, 'dtsg token', default=''),
                }),
                headers={
                    'Content-Type': 'application/x-www-form-urlencoded',
                })
            tahoe_js_data = self._parse_json(
                self._search_regex(
                    r'for\s+\(\s*;\s*;\s*\)\s*;(.+)', tahoe_data,
                    'tahoe js data', default='{}'),
                video_id, fatal=False)
            video_data = extract_from_jsmods_instances(tahoe_js_data)

        if not video_data:
            raise ExtractorError('Cannot parse data')

        if len(video_data) > 1:
            entries = []
            for v in video_data:
                video_url = v[0].get('video_url')
                if not video_url:
                    continue
                entries.append(self.url_result(urljoin(
                    url, video_url), self.ie_key(), v[0].get('video_id')))
            return self.playlist_result(entries, video_id)
        video_data = video_data[0]

        formats = []
        subtitles = {}
        for f in video_data:
            format_id = f['stream_type']
            if f and isinstance(f, dict):
                f = [f]

View on GitHub (pinned to 956b8c5855)

Solutions

  1. Update youtube-dl to the newest version (or switch to yt-dlp, which tracks Facebook layout changes much more actively)
  2. Pass --cookies from a logged-in session so Facebook returns the full page instead of a login wall
  3. Verify the URL actually points to a video post, not a photo or text-only post
  4. If it persists on the latest version, report it as an extractor bug with the URL

Example fix

# before
youtube_dl 'https://www.facebook.com/page/videos/123456'
# ERROR: Cannot parse data

# after
pip install -U yt-dlp
yt-dlp --cookies cookies.txt 'https://www.facebook.com/page/videos/123456'
Defensive patterns

Strategy: try-catch

Try / catch

try:
    info = ydl.extract_info(url, download=False)
except ExtractorError as e:
    if 'Cannot parse data' in str(e):
        # likely extractor out of date or login wall; retry once with cookies
        ydl.cookiefile = 'cookies.txt'
        info = ydl.extract_info(url, download=False)

Prevention

When it happens

Trigger: _real_extract downloads the webpage, video_data stays falsy through the HTML regex, the GraphQL video/attachment walk, the tahoe AJAX request, and then hits 'raise ExtractorError("Cannot parse data")'. Typical causes: Facebook A/B-tested new page structure, the page is behind a login redirect, or the tahoe endpoint returned empty JS data.

Common situations: Running an old youtube-dl release months after a Facebook frontend deploy; extracting from datacenter IPs that Facebook serves degraded pages to; URLs to non-video posts (photo albums, text posts) that contain no video metadata.

Related errors


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