From 09427cd91ec229d21263f1fc933b835251bf903c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ram=C3=B3n=20Sola?= Date: Mon, 4 Oct 2021 12:14:54 +0200 Subject: [PATCH] [atresplayer] handle invalid_request response (auth fail) inside handle_error --- yt_dlp/extractor/atresplayer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/yt_dlp/extractor/atresplayer.py b/yt_dlp/extractor/atresplayer.py index 20512cb79..937bce037 100644 --- a/yt_dlp/extractor/atresplayer.py +++ b/yt_dlp/extractor/atresplayer.py @@ -47,6 +47,8 @@ def _handle_error(self, e, code): error = self._parse_json(e.cause.read(), None) if error.get('error') == 'required_registered': self.raise_login_required() + if error.get('error') == 'invalid_request': + raise ExtractorError('Authentication failed', expected=True) raise ExtractorError(error['error_description'], expected=True) raise @@ -65,8 +67,6 @@ def _login(self): 'password': password, })) except ExtractorError as e: - if isinstance(e.cause, compat_HTTPError) and e.cause.code == 400: - raise ExtractorError('Authentication failure', expected=True) self._handle_error(e, 400) def _real_extract(self, url):