ytdl-org/youtube-dl · error · ExtractorError

Generic error. flag = %d

Error message

Generic error. flag = %d

What it means

Raised by the Le (LeTV/LeEco) extractor's _check_errors when the playJson msgs.playstatus has status == 0 with a flag value other than 1 (flag 1 is separately mapped to geo-restriction). It is expected=True; the flag number is included. Flags encode server-side denial reasons such as copyright removal or paywall.

Source

Thrown at youtube_dl/extractor/leeco.py:122

            _loc4_[2 * idx] = b // 16
            _loc4_[2 * idx + 1] = b % 16
        idx = len(_loc4_) - 11
        _loc4_ = _loc4_[idx:] + _loc4_[:idx]
        _loc7_ = bytearray(len(encrypted_data))
        for i in range(len(encrypted_data)):
            _loc7_[i] = _loc4_[2 * i] * 16 + _loc4_[2 * i + 1]

        return bytes(_loc7_)

    def _check_errors(self, play_json):
        # Check for errors
        playstatus = play_json['msgs']['playstatus']
        if playstatus['status'] == 0:
            flag = playstatus['flag']
            if flag == 1:
                self.raise_geo_restricted()
            else:
                raise ExtractorError('Generic error. flag = %d' % flag, expected=True)

    def _real_extract(self, url):
        media_id = self._match_id(url)
        page = self._download_webpage(url, media_id)

        play_json_flash = self._download_json(
            'http://player-pc.le.com/mms/out/video/playJson',
            media_id, 'Downloading flash playJson data', query={
                'id': media_id,
                'platid': 1,
                'splatid': 105,
                'format': 1,
                'source': 1000,
                'tkey': self.calc_time_key(int(time.time())),
                'domain': 'www.le.com',
                'region': 'cn',
            },
            headers=self.geo_verification_headers())

View on GitHub (pinned to 956b8c5855)

Solutions

  1. If the flag indicates paid content, pass cookies from a logged-in VIP account (--cookies)
  2. If copyright-related, look for the same show under a different (re-licensed) id on le.com
  3. Confirm in a browser whether the video plays at all from your region
  4. Update youtube-dl/yt-dlp in case flag semantics changed
Defensive patterns

Strategy: try-catch

Try / catch

try:
    ydl.extract_info(url)
except ExtractorError as e:
    if 'Generic error. flag =' in str(e):
        flag = int(str(e).rsplit('=', 1)[1].strip())
        if flag_indicates_vip(flag):
            retry_with_vip_cookies(url)
    else:
        raise

Prevention

When it happens

Trigger: Extracting a le.com video whose playJson returns playstatus.status=0 and flag not in {1, success}; e.g. flag values corresponding to video taken down for copyright, view limit reached, or VIP-only content requested anonymously.

Common situations: LeTV videos removed after Chinese copyright enforcement; VIP/paid videos attempted without cookies; region-adjacent blocks where flag 1 was expected but another code returned; aged le.com links whose media was delisted.

Related errors


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