{"record":{"id":"8fa617a3a48bf4ec","repo":"ytdl-org/youtube-dl","slug":"cannot-identify-player-r","errorCode":null,"errorMessage":"Cannot identify player %r","messagePattern":"Cannot identify player %r","errorType":"exception","errorClass":"ExtractorError","httpStatus":null,"severity":"error","filePath":"youtube_dl/extractor/youtube.py","lineNumber":1774,"sourceCode":"    def _download_player_url(self, video_id, fatal=False):\n        res = self._download_webpage(\n            'https://www.youtube.com/iframe_api',\n            note='Downloading iframe API JS', video_id=video_id, fatal=fatal)\n        player_version = self._search_regex(\n            r'player\\\\?/([0-9a-fA-F]{8})\\\\?/', res or '', 'player version', fatal=fatal,\n            default=NO_DEFAULT if res else None) or None\n        return player_version and 'https://www.youtube.com/s/player/{0}/player_ias.vflset/en_US/base.js'.format(player_version)\n\n    def _signature_cache_id(self, example_sig):\n        \"\"\" Return a string representation of a signature \"\"\"\n        return '.'.join(compat_str(len(part)) for part in example_sig.split('.'))\n\n    def _extract_player_info(self, player_url):\n        try:\n            return self._search_regex(\n                self._PLAYER_INFO_RE, player_url, 'player info', group='id')\n        except ExtractorError as e:\n            raise ExtractorError(\n                'Cannot identify player %r' % (player_url,), cause=e)\n\n    def _player_js_cache_key(self, player_url, extra_id=None, _cache={}):\n        if player_url not in _cache:\n            player_id = self._extract_player_info(player_url)\n            player_path = remove_start(\n                compat_urllib_parse.urlparse(player_url).path,\n                '/s/player/{0}/'.format(player_id))\n            variant = next((k for k, v in self._PLAYER_JS_VARIANT_MAP\n                           if v == player_path), None)\n            if not variant:\n                variant = next(\n                    (k for k, v in self._PLAYER_JS_VARIANT_MAP\n                     if re.match(re.escape(v).replace('en_US', r'\\w+') + '$', player_path)),\n                    None)\n            if not variant:\n                self.write_debug(\n                    'Unable to determine player JS variant\\n'","sourceCodeStart":1756,"sourceCodeEnd":1792,"githubUrl":"https://github.com/ytdl-org/youtube-dl/blob/956b8c585591b401a543e409accb163eeaaa1193/youtube_dl/extractor/youtube.py#L1756-L1792","documentation":"Raised by YoutubeIE._extract_player_info when the player URL does not match _PLAYER_INFO_RE, so the player version/id cannot be parsed. The original regex failure is chained as cause. This almost always means YouTube changed its player URL format (the code builds URLs like https://www.youtube.com/s/player/<version>/player_ias.vflset/en_US/base.js).","triggerScenarios":"Any code path that calls _extract_player_info (signature deciphering, nsig decryption, STS extraction) with a player_url whose shape no longer matches _PLAYER_INFO_RE — e.g. new URL schemes, a different path layout, or a None/relative URL that slipped through.","commonSituations":"YouTube rolls out a new player URL pattern; youtube-dl version is old relative to YouTube changes; the player URL came from a cached page or an embedded player host with a different path.","solutions":["Update youtube-dl to the latest release (or yt-dlp, which tracks player URL changes much faster) — regex fixes ship as patches.","Print player_url (the message includes it via %r) and compare with the current base.js URL in a browser; adjust _PLAYER_INFO_RE if you maintain a fork.","Clear cached player data so stale player URLs are not reused (the signature cache keys off player_url).","If embedding the library, pin to a known-good version and schedule prompt updates, since YouTube-side changes break old regexes."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"import re\nPLAYER_INFO_RE = YoutubeIE._PLAYER_INFO_RE\n\ndef player_url_parseable(player_url: str) -> bool:\n    return player_url is not None and re.search(PLAYER_INFO_RE, player_url) is not None","typeGuard":null,"tryCatchPattern":"try:\n    ...extraction...\nexcept ExtractorError as e:\n    if 'Cannot identify player' in str(e):\n        update_youtube_dl()  # player URL format changed; update first\n    raise","preventionTips":["Keep youtube-dl (or yt-dlp) current; player URL formats change without notice.","In long-running services, catch this error to trigger a self-update before retrying."],"tags":["youtube","player-url","regex","site-change"],"backgroundTag":null,"analyzedSha":"956b8c585591b401a543e409accb163eeaaa1193","analyzedAt":"2026-08-14T18:59:47.863Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}