import re
-from uuid import uuid4
+import uuid
from .common import InfoExtractor
-from ..compat import compat_HTTPError, compat_str
+from ..networking.exceptions import HTTPError
from ..utils import (
ExtractorError,
int_or_none,
def _perform_login(self, username, password):
try:
data = self._download_json(
- '%s/zapi/v2/account/login' % self._host_url(), None, 'Logging in',
+ f'{self._host_url()}/zapi/v2/account/login', None, 'Logging in',
data=urlencode_postdata({
'login': username,
'password': password,
'remember': 'true',
}), headers={
- 'Referer': '%s/login' % self._host_url(),
+ 'Referer': f'{self._host_url()}/login',
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
})
except ExtractorError as e:
- if isinstance(e.cause, compat_HTTPError) and e.cause.code == 400:
+ if isinstance(e.cause, HTTPError) and e.cause.status == 400:
raise ExtractorError(
'Unable to login: incorrect username and/or password',
expected=True)
# Will setup appropriate cookies
self._request_webpage(
- '%s/zapi/v3/session/hello' % self._host_url(), None,
+ f'{self._host_url()}/zapi/v3/session/hello', None,
'Opening session', data=urlencode_postdata({
- 'uuid': compat_str(uuid4()),
+ 'uuid': str(uuid.uuid4()),
'lang': 'en',
'app_version': '1.8.2',
'format': 'json',
def _extract_cid(self, video_id, channel_name):
channel_groups = self._download_json(
- '%s/zapi/v2/cached/channels/%s' % (self._host_url(),
- self._power_guide_hash),
+ f'{self._host_url()}/zapi/v2/cached/channels/{self._power_guide_hash}',
video_id, 'Downloading channel list',
query={'details': False})['channel_groups']
channel_list = []
def _extract_cid_and_video_info(self, video_id):
data = self._download_json(
- '%s/zapi/v2/cached/program/power_details/%s' % (
- self._host_url(), self._power_guide_hash),
+ f'{self._host_url()}/zapi/v2/cached/program/power_details/{self._power_guide_hash}',
video_id,
'Downloading video information',
query={
'season_number': int_or_none(p.get('s_no')),
'release_year': int_or_none(p.get('year')),
'categories': try_get(p, lambda x: x['c'], list),
- 'tags': try_get(p, lambda x: x['g'], list)
+ 'tags': try_get(p, lambda x: x['g'], list),
}
return cid, info_dict
@returns (ondemand_token, ondemand_type, info_dict)
"""
data = self._download_json(
- '%s/zapi/vod/movies/%s' % (self._host_url(), ondemand_id),
+ f'{self._host_url()}/zapi/vod/movies/{ondemand_id}',
ondemand_id, 'Downloading ondemand information')
info_dict = {
'id': ondemand_id,
if is_live:
postdata_common.update({'timeshift': 10800})
- url = '%s/zapi/watch/live/%s' % (self._host_url(), cid)
+ url = f'{self._host_url()}/zapi/watch/live/{cid}'
elif record_id:
- url = '%s/zapi/watch/recording/%s' % (self._host_url(), record_id)
+ url = f'{self._host_url()}/zapi/watch/recording/{record_id}'
elif ondemand_id:
postdata_common.update({
'teasable_id': ondemand_id,
'term_token': ondemand_termtoken,
- 'teasable_type': ondemand_type
+ 'teasable_type': ondemand_type,
})
- url = '%s/zapi/watch/vod/video' % self._host_url()
+ url = f'{self._host_url()}/zapi/watch/vod/video'
else:
- url = '%s/zapi/v3/watch/replay/%s/%s' % (self._host_url(), cid, video_id)
+ url = f'{self._host_url()}/zapi/v3/watch/replay/{cid}/{video_id}'
formats = []
subtitles = {}
for stream_type in ('dash', 'hls7'):
postdata['stream_type'] = stream_type
data = self._download_json(
- url, video_id, 'Downloading %s formats' % stream_type.upper(),
+ url, video_id, f'Downloading {stream_type.upper()} formats',
data=urlencode_postdata(postdata), fatal=False)
if not data:
continue
'title': channel_name,
'is_live': True,
'formats': formats,
- 'subtitles': subtitles
+ 'subtitles': subtitles,
}
def _extract_record(self, record_id):
'release_year': 2022,
'episode': 'Folge 1655',
'categories': 'count:1',
- 'tags': 'count:2'
+ 'tags': 'count:2',
},
- 'params': {'skip_download': 'm3u8'}
+ 'params': {'skip_download': 'm3u8'},
}, {
'url': 'https://zattoo.com/program/daserste/210177916',
'only_matching': True,
class NetPlusTVBaseIE(ZattooPlatformBaseIE):
_NETRC_MACHINE = 'netplus'
_HOST = 'netplus.tv'
- _API_HOST = 'www.%s' % _HOST
+ _API_HOST = f'www.{_HOST}'
class NetPlusTVIE(NetPlusTVBaseIE):
class BBVTVBaseIE(ZattooPlatformBaseIE):
_NETRC_MACHINE = 'bbvtv'
_HOST = 'bbv-tv.net'
- _API_HOST = 'www.%s' % _HOST
+ _API_HOST = f'www.{_HOST}'
class BBVTVIE(BBVTVBaseIE):
class VTXTVBaseIE(ZattooPlatformBaseIE):
_NETRC_MACHINE = 'vtxtv'
_HOST = 'vtxtv.ch'
- _API_HOST = 'www.%s' % _HOST
+ _API_HOST = f'www.{_HOST}'
class VTXTVIE(VTXTVBaseIE):
class SAKTVBaseIE(ZattooPlatformBaseIE):
_NETRC_MACHINE = 'saktv'
_HOST = 'saktv.ch'
- _API_HOST = 'www.%s' % _HOST
+ _API_HOST = f'www.{_HOST}'
class SAKTVIE(SAKTVBaseIE):
class QuantumTVBaseIE(ZattooPlatformBaseIE):
_NETRC_MACHINE = 'quantumtv'
_HOST = 'quantum-tv.com'
- _API_HOST = 'www.%s' % _HOST
+ _API_HOST = f'www.{_HOST}'
class QuantumTVIE(QuantumTVBaseIE):
class EinsUndEinsTVBaseIE(ZattooPlatformBaseIE):
_NETRC_MACHINE = '1und1tv'
_HOST = '1und1.tv'
- _API_HOST = 'www.%s' % _HOST
+ _API_HOST = f'www.{_HOST}'
class EinsUndEinsTVIE(EinsUndEinsTVBaseIE):