1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-10-04 14:15:22 -04:00

[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
This commit is contained in:
pukkandan
2022-03-19 02:23:33 +05:30
committed by GitHub
parent 028f6437f1
commit 52efa4b312
68 changed files with 253 additions and 569 deletions

View File

@@ -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):