diff options
author | pukkandan <pukkandan.ytdlp@gmail.com> | 2022-03-19 02:23:33 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-18 13:53:33 -0700 |
commit | 52efa4b31200119adaa8acf33e50b84fcb6948f0 (patch) | |
tree | f1963a4ade1111db9db8edea8fff0a7c58923cf9 /yt_dlp/extractor/zattoo.py | |
parent | 028f6437f1cb45bb9b3b286cba173b0588337feb (diff) |
[extractor] Add `_perform_login` function (#2943)
* Adds new functions `_initialize_pre_login` and `_perform_login` as part of the extractor API
* Adds `ie.supports_login` to the public API
Diffstat (limited to 'yt_dlp/extractor/zattoo.py')
-rw-r--r-- | yt_dlp/extractor/zattoo.py | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/yt_dlp/extractor/zattoo.py b/yt_dlp/extractor/zattoo.py index 9435920b2..c02b4ca14 100644 --- a/yt_dlp/extractor/zattoo.py +++ b/yt_dlp/extractor/zattoo.py @@ -25,13 +25,11 @@ class ZattooPlatformBaseIE(InfoExtractor): def _host_url(self): return 'https://%s' % (self._API_HOST if hasattr(self, '_API_HOST') else self._HOST) - def _login(self): - username, password = self._get_login_info() - if not username or not password: - self.raise_login_required( - 'A valid %s account is needed to access this media.' - % self._NETRC_MACHINE) + def _real_initialize(self): + if not self._power_guide_hash: + self.raise_login_required('An account is needed to access this media', method='password') + def _perform_login(self, username, password): try: data = self._download_json( '%s/zapi/v2/account/login' % self._host_url(), None, 'Logging in', @@ -52,7 +50,7 @@ class ZattooPlatformBaseIE(InfoExtractor): self._power_guide_hash = data['session']['power_guide_hash'] - def _real_initialize(self): + def _initialize_pre_login(self): webpage = self._download_webpage( self._host_url(), None, 'Downloading app token') app_token = self._html_search_regex( @@ -72,8 +70,6 @@ class ZattooPlatformBaseIE(InfoExtractor): 'format': 'json', })) - self._login() - def _extract_cid(self, video_id, channel_name): channel_groups = self._download_json( '%s/zapi/v2/cached/channels/%s' % (self._host_url(), |