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/hrti.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/hrti.py')
| -rw-r--r-- | yt_dlp/extractor/hrti.py | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/yt_dlp/extractor/hrti.py b/yt_dlp/extractor/hrti.py index dc5b9670c..36d600773 100644 --- a/yt_dlp/extractor/hrti.py +++ b/yt_dlp/extractor/hrti.py @@ -27,8 +27,9 @@ class HRTiBaseIE(InfoExtractor): _APP_VERSION = '1.1' _APP_PUBLICATION_ID = 'all_in_one' _API_URL = 'http://clientapi.hrt.hr/client_api.php/config/identify/format/json' + _token = None - def _initialize_api(self): + def _initialize_pre_login(self): init_data = { 'application_publication_id': self._APP_PUBLICATION_ID } @@ -64,12 +65,7 @@ class HRTiBaseIE(InfoExtractor): self._logout_url = modules['user']['resources']['logout']['uri'] - def _login(self): - username, password = self._get_login_info() - # TODO: figure out authentication with cookies - if username is None or password is None: - self.raise_login_required() - + def _perform_login(self, username, password): auth_data = { 'username': username, 'password': password, @@ -94,8 +90,9 @@ class HRTiBaseIE(InfoExtractor): self._token = auth_info['secure_streaming_token'] def _real_initialize(self): - self._initialize_api() - self._login() + if not self._token: + # TODO: figure out authentication with cookies + self.raise_login_required(method='password') class HRTiIE(HRTiBaseIE): |
