aboutsummaryrefslogtreecommitdiffstats
path: root/hypervideo_dl/extractor/zattoo.py
diff options
context:
space:
mode:
Diffstat (limited to 'hypervideo_dl/extractor/zattoo.py')
-rw-r--r--hypervideo_dl/extractor/zattoo.py25
1 files changed, 8 insertions, 17 deletions
diff --git a/hypervideo_dl/extractor/zattoo.py b/hypervideo_dl/extractor/zattoo.py
index a13d124..c02b4ca 100644
--- a/hypervideo_dl/extractor/zattoo.py
+++ b/hypervideo_dl/extractor/zattoo.py
@@ -12,6 +12,7 @@ from ..compat import (
from ..utils import (
ExtractorError,
int_or_none,
+ join_nonempty,
try_get,
url_or_none,
urlencode_postdata,
@@ -24,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',
@@ -51,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(
@@ -71,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(),
@@ -156,15 +153,9 @@ class ZattooPlatformBaseIE(InfoExtractor):
watch_url = url_or_none(watch.get('url'))
if not watch_url:
continue
- format_id_list = [stream_type]
- maxrate = watch.get('maxrate')
- if maxrate:
- format_id_list.append(compat_str(maxrate))
audio_channel = watch.get('audio_channel')
- if audio_channel:
- format_id_list.append(compat_str(audio_channel))
preference = 1 if audio_channel == 'A' else None
- format_id = '-'.join(format_id_list)
+ format_id = join_nonempty(stream_type, watch.get('maxrate'), audio_channel)
if stream_type in ('dash', 'dash_widevine', 'dash_playready'):
this_formats = self._extract_mpd_formats(
watch_url, video_id, mpd_id=format_id, fatal=False)
@@ -192,7 +183,7 @@ class ZattooPlatformBaseIE(InfoExtractor):
cid = self._extract_cid(video_id, channel_name)
info_dict = {
'id': channel_name,
- 'title': self._live_title(channel_name),
+ 'title': channel_name,
'is_live': True,
}
else: