{"record":{"id":"23af03b8f85ccbae","repo":"ytdl-org/youtube-dl","slug":"error-error-description","errorCode":null,"errorMessage":"error['error_description']","messagePattern":"error\\['error_description'\\]","errorType":"exception","errorClass":"ExtractorError","httpStatus":null,"severity":"error","filePath":"youtube_dl/extractor/atresplayer.py","lineNumber":52,"sourceCode":"            'url': 'https://www.atresplayer.com/lasexta/programas/el-club-de-la-comedia/temporada-4/capitulo-10-especial-solidario-nochebuena_5ad08edf986b2855ed47adc4/',\n            'only_matching': True,\n        },\n        {\n            'url': 'https://www.atresplayer.com/antena3/series/el-secreto-de-puente-viejo/el-chico-de-los-tres-lunares/capitulo-977-29-12-14_5ad51046986b2886722ccdea/',\n            'only_matching': True,\n        },\n    ]\n    _API_BASE = 'https://api.atresplayer.com/'\n\n    def _real_initialize(self):\n        self._login()\n\n    def _handle_error(self, e, code):\n        if isinstance(e.cause, compat_HTTPError) and e.cause.code == code:\n            error = self._parse_json(e.cause.read(), None)\n            if error.get('error') == 'required_registered':\n                self.raise_login_required()\n            raise ExtractorError(error['error_description'], expected=True)\n        raise\n\n    def _login(self):\n        username, password = self._get_login_info()\n        if username is None:\n            return\n\n        self._request_webpage(\n            self._API_BASE + 'login', None, 'Downloading login page')\n\n        try:\n            target_url = self._download_json(\n                'https://account.atresmedia.com/api/login', None,\n                'Logging in', headers={\n                    'Content-Type': 'application/x-www-form-urlencoded'\n                }, data=urlencode_postdata({\n                    'username': username,\n                    'password': password,","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/ytdl-org/youtube-dl/blob/956b8c585591b401a543e409accb163eeaaa1193/youtube_dl/extractor/atresplayer.py#L34-L70","documentation":"Raised by the Atresplayer error handler when a download fails with an HTTP error whose status code matches the expected code and the response body parses as JSON containing error_description. If the error field equals 'required_registered', the extractor instead raises a login-required error before this line. Marked expected=True.","triggerScenarios":"API request to api.atresplayer.com returning an HTTPError whose body JSON has error_description; e.g. 403 for premium-only content without a Premium subscription, or expiredNamac / geolocation errors; _handle_error(e, 403) or 400 call sites in login and extraction.","commonSituations":"Non-Premium account hitting Premium content; geoblocking outside Spain; expired session tokens requiring re-login; API schema change dropping error_description (which would then raise KeyError).","solutions":["Read the embedded error_description: 'required_registered' → log in; 'required_premium' → upgrade; geolocation → use a Spain IP","Supply --username/--password of an account entitled to the content","If you get a KeyError on error_description, the API error shape changed — report upstream"],"exampleFix":"# before\nyoutube-dl 'https://www.atresplayer.com/series/premium-show/'\n\n# after\nyoutube-dl --username user@example.com --password pass 'https://www.atresplayer.com/series/premium-show/'  # entitled account + Spain IP","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    ydl.extract_info(url)\nexcept (ExtractorError, KeyError) as e:\n    msg = str(e)\n    if 'required_premium' in msg:\n        requeue_with_premium_account(url)\n    elif 'geoloc' in msg.lower() or 'geo' in msg.lower():\n        requeue_with_region(url, 'ES')\n    else:\n        log_atresplayer_api_error(url, msg)","preventionTips":["Check error_description text first — it names the exact cause (login, premium, geo)","Use a Spain IP and an entitled account for Atresplayer Premium content","Also catch KeyError: bodies without error_description crash _handle_error itself"],"tags":["atresplayer","api-error","geo-restriction","subscription"],"backgroundTag":null,"analyzedSha":"956b8c585591b401a543e409accb163eeaaa1193","analyzedAt":"2026-08-14T18:59:47.863Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}