{"record":{"id":"7568f0429c9ba089","repo":"ytdl-org/youtube-dl","slug":"generic-error-flag-d","errorCode":null,"errorMessage":"Generic error. flag = %d","messagePattern":"Generic error\\. flag = (.+?)","errorType":"exception","errorClass":"ExtractorError","httpStatus":null,"severity":"error","filePath":"youtube_dl/extractor/leeco.py","lineNumber":122,"sourceCode":"            _loc4_[2 * idx] = b // 16\n            _loc4_[2 * idx + 1] = b % 16\n        idx = len(_loc4_) - 11\n        _loc4_ = _loc4_[idx:] + _loc4_[:idx]\n        _loc7_ = bytearray(len(encrypted_data))\n        for i in range(len(encrypted_data)):\n            _loc7_[i] = _loc4_[2 * i] * 16 + _loc4_[2 * i + 1]\n\n        return bytes(_loc7_)\n\n    def _check_errors(self, play_json):\n        # Check for errors\n        playstatus = play_json['msgs']['playstatus']\n        if playstatus['status'] == 0:\n            flag = playstatus['flag']\n            if flag == 1:\n                self.raise_geo_restricted()\n            else:\n                raise ExtractorError('Generic error. flag = %d' % flag, expected=True)\n\n    def _real_extract(self, url):\n        media_id = self._match_id(url)\n        page = self._download_webpage(url, media_id)\n\n        play_json_flash = self._download_json(\n            'http://player-pc.le.com/mms/out/video/playJson',\n            media_id, 'Downloading flash playJson data', query={\n                'id': media_id,\n                'platid': 1,\n                'splatid': 105,\n                'format': 1,\n                'source': 1000,\n                'tkey': self.calc_time_key(int(time.time())),\n                'domain': 'www.le.com',\n                'region': 'cn',\n            },\n            headers=self.geo_verification_headers())","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/ytdl-org/youtube-dl/blob/956b8c585591b401a543e409accb163eeaaa1193/youtube_dl/extractor/leeco.py#L104-L140","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["If the flag indicates paid content, pass cookies from a logged-in VIP account (--cookies)","If copyright-related, look for the same show under a different (re-licensed) id on le.com","Confirm in a browser whether the video plays at all from your region","Update youtube-dl/yt-dlp in case flag semantics changed"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    ydl.extract_info(url)\nexcept ExtractorError as e:\n    if 'Generic error. flag =' in str(e):\n        flag = int(str(e).rsplit('=', 1)[1].strip())\n        if flag_indicates_vip(flag):\n            retry_with_vip_cookies(url)\n    else:\n        raise","preventionTips":["Supply le.com session cookies for VIP content up front","Treat non-geo flag failures as permanent (copyright/paywall) in batch jobs"],"tags":["leeco","letv","api-error","copyright","extractor"],"backgroundTag":null,"analyzedSha":"956b8c585591b401a543e409accb163eeaaa1193","analyzedAt":"2026-08-14T18:59:47.863Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}