{"record":{"id":"bcbc9545453f2bea","repo":"ytdl-org/youtube-dl","slug":"error-msg-xpath-text-auth-error-msg","errorCode":null,"errorMessage":"error_msg (xpath_text(auth, 'error/msg'))","messagePattern":"error_msg \\(xpath_text\\(auth, 'error/msg'\\)\\)","errorType":"exception","errorClass":"ExtractorError","httpStatus":null,"severity":"error","filePath":"youtube_dl/extractor/turner.py","lineNumber":46,"sourceCode":"\n    def _add_akamai_spe_token(self, tokenizer_src, video_url, content_id, ap_data, custom_tokenizer_query=None):\n        secure_path = self._search_regex(r'https?://[^/]+(.+/)', video_url, 'secure path') + '*'\n        token = self._AKAMAI_SPE_TOKEN_CACHE.get(secure_path)\n        if not token:\n            query = {\n                'path': secure_path,\n            }\n            if custom_tokenizer_query:\n                query.update(custom_tokenizer_query)\n            else:\n                query['videoId'] = content_id\n            if ap_data.get('auth_required'):\n                query['accessToken'] = self._extract_mvpd_auth(ap_data['url'], content_id, ap_data['site_name'], ap_data['site_name'])\n            auth = self._download_xml(\n                tokenizer_src, content_id, query=query)\n            error_msg = xpath_text(auth, 'error/msg')\n            if error_msg:\n                raise ExtractorError(error_msg, expected=True)\n            token = xpath_text(auth, 'token')\n            if not token:\n                return video_url\n            self._AKAMAI_SPE_TOKEN_CACHE[secure_path] = token\n        return video_url + '?hdnea=' + token\n\n    def _extract_cvp_info(self, data_src, video_id, path_data={}, ap_data={}, fatal=False):\n        video_data = self._download_xml(\n            data_src, video_id,\n            transform_source=lambda s: fix_xml_ampersands(s).strip(),\n            fatal=fatal)\n        if not video_data:\n            return {}\n        video_id = video_data.attrib['id']\n        title = xpath_text(video_data, 'headline', fatal=True)\n        content_id = xpath_text(video_data, 'contentId') or video_id\n        # rtmp_src = xpath_text(video_data, 'akamai/src')\n        # if rtmp_src:","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/ytdl-org/youtube-dl/blob/956b8c585591b401a543e409accb163eeaaa1193/youtube_dl/extractor/turner.py#L28-L64","documentation":"Raised by the Turner (CNN/TBS/TNT/etc.) CVP tokenizer flow when the token XML contains a non-empty error/msg node (e.g. 'Media is not available', auth errors). Expected=True; the message text comes directly from the Akamai/tokenizer service response.","triggerScenarios":"Requesting a secure media path on a Turner property where the tokenizer (with optional accessToken from MVPD auth) responds with an <error><msg>...</msg></error> instead of a token: expired asset, geo restriction, or required TV-provider login (auth_required) that was not satisfied.","commonSituations":"TVE clips behind cable authentication; videos expired after their rights window; region restrictions; stale youtube-dl where the tokenizer query parameters (e.g. videoId vs custom query) no longer match the current Turner stack (now part of Warner Bros. Discovery).","solutions":["Play the video on the origin site in a browser; if it demands a TV-provider login, authenticate in the browser and pass cookies (yt-dlp --cookies-from-browser)","Update to yt-dlp, whose Turner/Adobe-TVE handling is actively maintained","If geo-blocked, use an exit IP in the allowed region","Catch expected ExtractorError in batch pipelines and record the server's msg verbatim for triage"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    ydl.extract_info(turner_url)\nexcept ExtractorError as e:\n    if e.expected and any(k in str(e) for k in ('auth', 'entitled', 'geo', 'available')):\n        if needs_tv_auth(str(e)):\n            retry_with_cookies(turner_url)\n        elif is_geo(str(e)):\n            retry_with_us_exit(turner_url)","preventionTips":["Authenticate in a browser and pass cookies for TVE-gated Turner content","Use an appropriate exit IP for region-licensed clips","Log the tokenizer's error msg verbatim for triage"],"tags":["extractor","tokenizer","turner","auth","expected"],"backgroundTag":null,"analyzedSha":"956b8c585591b401a543e409accb163eeaaa1193","analyzedAt":"2026-08-14T18:59:47.863Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}