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.py708
1 files changed, 574 insertions, 134 deletions
diff --git a/hypervideo_dl/extractor/zattoo.py b/hypervideo_dl/extractor/zattoo.py
index c02b4ca..22620c0 100644
--- a/hypervideo_dl/extractor/zattoo.py
+++ b/hypervideo_dl/extractor/zattoo.py
@@ -1,14 +1,8 @@
-# coding: utf-8
-from __future__ import unicode_literals
-
import re
from uuid import uuid4
from .common import InfoExtractor
-from ..compat import (
- compat_HTTPError,
- compat_str,
-)
+from ..compat import compat_HTTPError, compat_str
from ..utils import (
ExtractorError,
int_or_none,
@@ -51,25 +45,30 @@ class ZattooPlatformBaseIE(InfoExtractor):
self._power_guide_hash = data['session']['power_guide_hash']
def _initialize_pre_login(self):
- webpage = self._download_webpage(
- self._host_url(), None, 'Downloading app token')
- app_token = self._html_search_regex(
- r'appToken\s*=\s*(["\'])(?P<token>(?:(?!\1).)+?)\1',
- webpage, 'app token', group='token')
- app_version = self._html_search_regex(
- r'<!--\w+-(.+?)-', webpage, 'app version', default='2.8.2')
+ session_token = self._download_json(
+ f'{self._host_url()}/token.json', None, 'Downloading session token')['session_token']
# Will setup appropriate cookies
self._request_webpage(
- '%s/zapi/v2/session/hello' % self._host_url(), None,
+ '%s/zapi/v3/session/hello' % self._host_url(), None,
'Opening session', data=urlencode_postdata({
- 'client_app_token': app_token,
'uuid': compat_str(uuid4()),
'lang': 'en',
- 'app_version': app_version,
+ 'app_version': '1.8.2',
'format': 'json',
+ 'client_app_token': session_token,
}))
+ def _extract_video_id_from_recording(self, recid):
+ playlist = self._download_json(
+ f'{self._host_url()}/zapi/v2/playlist', recid, 'Downloading playlist')
+ try:
+ return next(
+ str(item['program_id']) for item in playlist['recordings']
+ if item.get('program_id') and str(item.get('id')) == recid)
+ except (StopIteration, KeyError):
+ raise ExtractorError('Could not extract video id from recording')
+
def _extract_cid(self, video_id, channel_name):
channel_groups = self._download_json(
'%s/zapi/v2/cached/channels/%s' % (self._host_url(),
@@ -118,7 +117,26 @@ class ZattooPlatformBaseIE(InfoExtractor):
return cid, info_dict
- def _extract_formats(self, cid, video_id, record_id=None, is_live=False):
+ def _extract_ondemand_info(self, ondemand_id):
+ """
+ @returns (ondemand_token, ondemand_type, info_dict)
+ """
+ data = self._download_json(
+ '%s/zapi/vod/movies/%s' % (self._host_url(), ondemand_id),
+ ondemand_id, 'Downloading ondemand information')
+ info_dict = {
+ 'id': ondemand_id,
+ 'title': data.get('title'),
+ 'description': data.get('description'),
+ 'duration': int_or_none(data.get('duration')),
+ 'release_year': int_or_none(data.get('year')),
+ 'episode_number': int_or_none(data.get('episode_number')),
+ 'season_number': int_or_none(data.get('season_number')),
+ 'categories': try_get(data, lambda x: x['categories'], list),
+ }
+ return data['terms_catalog'][0]['terms'][0]['token'], data['type'], info_dict
+
+ def _extract_formats(self, cid, video_id, record_id=None, ondemand_id=None, ondemand_termtoken=None, ondemand_type=None, is_live=False):
postdata_common = {
'https_watch_urls': True,
}
@@ -128,11 +146,18 @@ class ZattooPlatformBaseIE(InfoExtractor):
url = '%s/zapi/watch/live/%s' % (self._host_url(), cid)
elif record_id:
url = '%s/zapi/watch/recording/%s' % (self._host_url(), record_id)
+ elif ondemand_id:
+ postdata_common.update({
+ 'teasable_id': ondemand_id,
+ 'term_token': ondemand_termtoken,
+ 'teasable_type': ondemand_type
+ })
+ url = '%s/zapi/watch/vod/video' % self._host_url()
else:
- url = '%s/zapi/watch/recall/%s/%s' % (self._host_url(), cid, video_id)
-
+ url = '%s/zapi/v3/watch/replay/%s/%s' % (self._host_url(), cid, video_id)
formats = []
- for stream_type in ('dash', 'hls', 'hls5', 'hds'):
+ subtitles = {}
+ for stream_type in ('dash', 'hls7'):
postdata = postdata_common.copy()
postdata['stream_type'] = stream_type
@@ -156,14 +181,16 @@ class ZattooPlatformBaseIE(InfoExtractor):
audio_channel = watch.get('audio_channel')
preference = 1 if audio_channel == 'A' else None
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(
+ if stream_type.startswith('dash'):
+ this_formats, subs = self._extract_mpd_formats_and_subtitles(
watch_url, video_id, mpd_id=format_id, fatal=False)
- elif stream_type in ('hls', 'hls5', 'hls5_fairplay'):
- this_formats = self._extract_m3u8_formats(
+ self._merge_subtitles(subs, target=subtitles)
+ elif stream_type.startswith('hls'):
+ this_formats, subs = self._extract_m3u8_formats_and_subtitles(
watch_url, video_id, 'mp4',
entry_protocol='m3u8_native', m3u8_id=format_id,
fatal=False)
+ self._merge_subtitles(subs, target=subtitles)
elif stream_type == 'hds':
this_formats = self._extract_f4m_formats(
watch_url, video_id, f4m_id=format_id, fatal=False)
@@ -175,58 +202,48 @@ class ZattooPlatformBaseIE(InfoExtractor):
for this_format in this_formats:
this_format['quality'] = preference
formats.extend(this_formats)
- self._sort_formats(formats)
- return formats
+ return formats, subtitles
- def _extract_video(self, channel_name, video_id, record_id=None, is_live=False):
- if is_live:
- cid = self._extract_cid(video_id, channel_name)
- info_dict = {
- 'id': channel_name,
- 'title': channel_name,
- 'is_live': True,
- }
- else:
- cid, info_dict = self._extract_cid_and_video_info(video_id)
- formats = self._extract_formats(
- cid, video_id, record_id=record_id, is_live=is_live)
- info_dict['formats'] = formats
+ def _extract_video(self, video_id, record_id=None):
+ cid, info_dict = self._extract_cid_and_video_info(video_id)
+ info_dict['formats'], info_dict['subtitles'] = self._extract_formats(cid, video_id, record_id=record_id)
return info_dict
+ def _extract_live(self, channel_name):
+ cid = self._extract_cid(channel_name, channel_name)
+ formats, subtitles = self._extract_formats(cid, cid, is_live=True)
+ return {
+ 'id': channel_name,
+ 'title': channel_name,
+ 'is_live': True,
+ 'formats': formats,
+ 'subtitles': subtitles
+ }
-class QuicklineBaseIE(ZattooPlatformBaseIE):
- _NETRC_MACHINE = 'quickline'
- _HOST = 'mobiltv.quickline.com'
-
-
-class QuicklineIE(QuicklineBaseIE):
- _VALID_URL = r'https?://(?:www\.)?%s/watch/(?P<channel>[^/]+)/(?P<id>[0-9]+)' % re.escape(QuicklineBaseIE._HOST)
+ def _extract_record(self, record_id):
+ video_id = self._extract_video_id_from_recording(record_id)
+ cid, info_dict = self._extract_cid_and_video_info(video_id)
+ info_dict['formats'], info_dict['subtitles'] = self._extract_formats(cid, video_id, record_id=record_id)
+ return info_dict
- _TEST = {
- 'url': 'https://mobiltv.quickline.com/watch/prosieben/130671867-maze-runner-die-auserwaehlten-in-der-brandwueste',
- 'only_matching': True,
- }
+ def _extract_ondemand(self, ondemand_id):
+ ondemand_termtoken, ondemand_type, info_dict = self._extract_ondemand_info(ondemand_id)
+ info_dict['formats'], info_dict['subtitles'] = self._extract_formats(
+ None, ondemand_id, ondemand_id=ondemand_id,
+ ondemand_termtoken=ondemand_termtoken, ondemand_type=ondemand_type)
+ return info_dict
def _real_extract(self, url):
- channel_name, video_id = self._match_valid_url(url).groups()
- return self._extract_video(channel_name, video_id)
-
+ video_id, record_id = self._match_valid_url(url).groups()
+ return getattr(self, f'_extract_{self._TYPE}')(video_id or record_id)
-class QuicklineLiveIE(QuicklineBaseIE):
- _VALID_URL = r'https?://(?:www\.)?%s/watch/(?P<id>[^/]+)' % re.escape(QuicklineBaseIE._HOST)
- _TEST = {
- 'url': 'https://mobiltv.quickline.com/watch/srf1',
- 'only_matching': True,
- }
-
- @classmethod
- def suitable(cls, url):
- return False if QuicklineIE.suitable(url) else super(QuicklineLiveIE, cls).suitable(url)
-
- def _real_extract(self, url):
- channel_name = video_id = self._match_id(url)
- return self._extract_video(channel_name, video_id, is_live=True)
+def _create_valid_url(host, match, qs, base_re=None):
+ match_base = fr'|{base_re}/(?P<vid1>{match})' if base_re else '(?P<vid1>)'
+ return rf'''(?x)https?://(?:www\.)?{re.escape(host)}/(?:
+ [^?#]+\?(?:[^#]+&)?{qs}=(?P<vid2>{match})
+ {match_base}
+ )'''
class ZattooBaseIE(ZattooPlatformBaseIE):
@@ -234,191 +251,614 @@ class ZattooBaseIE(ZattooPlatformBaseIE):
_HOST = 'zattoo.com'
-def _make_valid_url(tmpl, host):
- return tmpl % re.escape(host)
-
-
class ZattooIE(ZattooBaseIE):
- _VALID_URL_TEMPLATE = r'https?://(?:www\.)?%s/watch/(?P<channel>[^/]+?)/(?P<id>[0-9]+)[^/]+(?:/(?P<recid>[0-9]+))?'
- _VALID_URL = _make_valid_url(_VALID_URL_TEMPLATE, ZattooBaseIE._HOST)
-
- # Since regular videos are only available for 7 days and recorded videos
- # are only available for a specific user, we cannot have detailed tests.
+ _VALID_URL = _create_valid_url(ZattooBaseIE._HOST, r'\d+', 'program', '(?:program|watch)/[^/]+')
+ _TYPE = 'video'
_TESTS = [{
- 'url': 'https://zattoo.com/watch/prosieben/130671867-maze-runner-die-auserwaehlten-in-der-brandwueste',
+ 'url': 'https://zattoo.com/program/zdf/250170418',
+ 'info_dict': {
+ 'id': '250170418',
+ 'ext': 'mp4',
+ 'title': 'Markus Lanz',
+ 'description': 'md5:e41cb1257de008ca62a73bb876ffa7fc',
+ 'thumbnail': 're:http://images.zattic.com/cms/.+/format_480x360.jpg',
+ 'creator': 'ZDF HD',
+ 'release_year': 2022,
+ 'episode': 'Folge 1655',
+ 'categories': 'count:1',
+ 'tags': 'count:2'
+ },
+ 'params': {'skip_download': 'm3u8'}
+ }, {
+ 'url': 'https://zattoo.com/program/daserste/210177916',
'only_matching': True,
}, {
- 'url': 'https://zattoo.com/watch/srf_zwei/132905652-eishockey-spengler-cup/102791477/1512211800000/1514433500000/92000',
+ 'url': 'https://zattoo.com/guide/german?channel=srf1&program=169860555',
'only_matching': True,
}]
- def _real_extract(self, url):
- channel_name, video_id, record_id = self._match_valid_url(url).groups()
- return self._extract_video(channel_name, video_id, record_id)
-
class ZattooLiveIE(ZattooBaseIE):
- _VALID_URL = r'https?://(?:www\.)?zattoo\.com/watch/(?P<id>[^/]+)'
-
- _TEST = {
- 'url': 'https://zattoo.com/watch/srf1',
+ _VALID_URL = _create_valid_url(ZattooBaseIE._HOST, r'[^/?&#]+', 'channel', 'live')
+ _TYPE = 'live'
+ _TESTS = [{
+ 'url': 'https://zattoo.com/channels/german?channel=srf_zwei',
+ 'only_matching': True,
+ }, {
+ 'url': 'https://zattoo.com/live/srf1',
'only_matching': True,
- }
+ }]
@classmethod
def suitable(cls, url):
- return False if ZattooIE.suitable(url) else super(ZattooLiveIE, cls).suitable(url)
+ return False if ZattooIE.suitable(url) else super().suitable(url)
+
+
+class ZattooMoviesIE(ZattooBaseIE):
+ _VALID_URL = _create_valid_url(ZattooBaseIE._HOST, r'\w+', 'movie_id', 'vod/movies')
+ _TYPE = 'ondemand'
+ _TESTS = [{
+ 'url': 'https://zattoo.com/vod/movies/7521',
+ 'only_matching': True,
+ }, {
+ 'url': 'https://zattoo.com/ondemand?movie_id=7521&term_token=9f00f43183269484edde',
+ 'only_matching': True,
+ }]
- def _real_extract(self, url):
- channel_name = video_id = self._match_id(url)
- return self._extract_video(channel_name, video_id, is_live=True)
+class ZattooRecordingsIE(ZattooBaseIE):
+ _VALID_URL = _create_valid_url('zattoo.com', r'\d+', 'recording')
+ _TYPE = 'record'
+ _TESTS = [{
+ 'url': 'https://zattoo.com/recordings?recording=193615508',
+ 'only_matching': True,
+ }, {
+ 'url': 'https://zattoo.com/tc/ptc_recordings_all_recordings?recording=193615420',
+ 'only_matching': True,
+ }]
-class NetPlusIE(ZattooIE):
+
+class NetPlusTVBaseIE(ZattooPlatformBaseIE):
_NETRC_MACHINE = 'netplus'
_HOST = 'netplus.tv'
_API_HOST = 'www.%s' % _HOST
- _VALID_URL = _make_valid_url(ZattooIE._VALID_URL_TEMPLATE, _HOST)
+
+class NetPlusTVIE(NetPlusTVBaseIE):
+ _VALID_URL = _create_valid_url(NetPlusTVBaseIE._HOST, r'\d+', 'program', '(?:program|watch)/[^/]+')
+ _TYPE = 'video'
+ _TESTS = [{
+ 'url': 'https://netplus.tv/program/daserste/210177916',
+ 'only_matching': True,
+ }, {
+ 'url': 'https://netplus.tv/guide/german?channel=srf1&program=169860555',
+ 'only_matching': True,
+ }]
+
+
+class NetPlusTVLiveIE(NetPlusTVBaseIE):
+ _VALID_URL = _create_valid_url(NetPlusTVBaseIE._HOST, r'[^/?&#]+', 'channel', 'live')
+ _TYPE = 'live'
+ _TESTS = [{
+ 'url': 'https://netplus.tv/channels/german?channel=srf_zwei',
+ 'only_matching': True,
+ }, {
+ 'url': 'https://netplus.tv/live/srf1',
+ 'only_matching': True,
+ }]
+
+ @classmethod
+ def suitable(cls, url):
+ return False if NetPlusTVIE.suitable(url) else super().suitable(url)
+
+
+class NetPlusTVRecordingsIE(NetPlusTVBaseIE):
+ _VALID_URL = _create_valid_url(NetPlusTVBaseIE._HOST, r'\d+', 'recording')
+ _TYPE = 'record'
_TESTS = [{
- 'url': 'https://www.netplus.tv/watch/abc/123-abc',
+ 'url': 'https://netplus.tv/recordings?recording=193615508',
+ 'only_matching': True,
+ }, {
+ 'url': 'https://netplus.tv/tc/ptc_recordings_all_recordings?recording=193615420',
'only_matching': True,
}]
-class MNetTVIE(ZattooIE):
+class MNetTVBaseIE(ZattooPlatformBaseIE):
_NETRC_MACHINE = 'mnettv'
_HOST = 'tvplus.m-net.de'
- _VALID_URL = _make_valid_url(ZattooIE._VALID_URL_TEMPLATE, _HOST)
+
+class MNetTVIE(MNetTVBaseIE):
+ _VALID_URL = _create_valid_url(MNetTVBaseIE._HOST, r'\d+', 'program', '(?:program|watch)/[^/]+')
+ _TYPE = 'video'
_TESTS = [{
- 'url': 'https://tvplus.m-net.de/watch/abc/123-abc',
+ 'url': 'https://tvplus.m-net.de/program/daserste/210177916',
+ 'only_matching': True,
+ }, {
+ 'url': 'https://tvplus.m-net.de/guide/german?channel=srf1&program=169860555',
+ 'only_matching': True,
+ }]
+
+
+class MNetTVLiveIE(MNetTVBaseIE):
+ _VALID_URL = _create_valid_url(MNetTVBaseIE._HOST, r'[^/?&#]+', 'channel', 'live')
+ _TYPE = 'live'
+ _TESTS = [{
+ 'url': 'https://tvplus.m-net.de/channels/german?channel=srf_zwei',
+ 'only_matching': True,
+ }, {
+ 'url': 'https://tvplus.m-net.de/live/srf1',
+ 'only_matching': True,
+ }]
+
+ @classmethod
+ def suitable(cls, url):
+ return False if MNetTVIE.suitable(url) else super().suitable(url)
+
+
+class MNetTVRecordingsIE(MNetTVBaseIE):
+ _VALID_URL = _create_valid_url(MNetTVBaseIE._HOST, r'\d+', 'recording')
+ _TYPE = 'record'
+ _TESTS = [{
+ 'url': 'https://tvplus.m-net.de/recordings?recording=193615508',
+ 'only_matching': True,
+ }, {
+ 'url': 'https://tvplus.m-net.de/tc/ptc_recordings_all_recordings?recording=193615420',
'only_matching': True,
}]
-class WalyTVIE(ZattooIE):
+class WalyTVBaseIE(ZattooPlatformBaseIE):
_NETRC_MACHINE = 'walytv'
_HOST = 'player.waly.tv'
- _VALID_URL = _make_valid_url(ZattooIE._VALID_URL_TEMPLATE, _HOST)
+
+class WalyTVIE(WalyTVBaseIE):
+ _VALID_URL = _create_valid_url(WalyTVBaseIE._HOST, r'\d+', 'program', '(?:program|watch)/[^/]+')
+ _TYPE = 'video'
+ _TESTS = [{
+ 'url': 'https://player.waly.tv/program/daserste/210177916',
+ 'only_matching': True,
+ }, {
+ 'url': 'https://player.waly.tv/guide/german?channel=srf1&program=169860555',
+ 'only_matching': True,
+ }]
+
+
+class WalyTVLiveIE(WalyTVBaseIE):
+ _VALID_URL = _create_valid_url(WalyTVBaseIE._HOST, r'[^/?&#]+', 'channel', 'live')
+ _TYPE = 'live'
_TESTS = [{
- 'url': 'https://player.waly.tv/watch/abc/123-abc',
+ 'url': 'https://player.waly.tv/channels/german?channel=srf_zwei',
+ 'only_matching': True,
+ }, {
+ 'url': 'https://player.waly.tv/live/srf1',
'only_matching': True,
}]
+ @classmethod
+ def suitable(cls, url):
+ return False if WalyTVIE.suitable(url) else super().suitable(url)
+
-class BBVTVIE(ZattooIE):
+class WalyTVRecordingsIE(WalyTVBaseIE):
+ _VALID_URL = _create_valid_url(WalyTVBaseIE._HOST, r'\d+', 'recording')
+ _TYPE = 'record'
+ _TESTS = [{
+ 'url': 'https://player.waly.tv/recordings?recording=193615508',
+ 'only_matching': True,
+ }, {
+ 'url': 'https://player.waly.tv/tc/ptc_recordings_all_recordings?recording=193615420',
+ 'only_matching': True,
+ }]
+
+
+class BBVTVBaseIE(ZattooPlatformBaseIE):
_NETRC_MACHINE = 'bbvtv'
_HOST = 'bbv-tv.net'
_API_HOST = 'www.%s' % _HOST
- _VALID_URL = _make_valid_url(ZattooIE._VALID_URL_TEMPLATE, _HOST)
+
+class BBVTVIE(BBVTVBaseIE):
+ _VALID_URL = _create_valid_url(BBVTVBaseIE._HOST, r'\d+', 'program', '(?:program|watch)/[^/]+')
+ _TYPE = 'video'
+ _TESTS = [{
+ 'url': 'https://bbv-tv.net/program/daserste/210177916',
+ 'only_matching': True,
+ }, {
+ 'url': 'https://bbv-tv.net/guide/german?channel=srf1&program=169860555',
+ 'only_matching': True,
+ }]
+
+
+class BBVTVLiveIE(BBVTVBaseIE):
+ _VALID_URL = _create_valid_url(BBVTVBaseIE._HOST, r'[^/?&#]+', 'channel', 'live')
+ _TYPE = 'live'
_TESTS = [{
- 'url': 'https://www.bbv-tv.net/watch/abc/123-abc',
+ 'url': 'https://bbv-tv.net/channels/german?channel=srf_zwei',
+ 'only_matching': True,
+ }, {
+ 'url': 'https://bbv-tv.net/live/srf1',
'only_matching': True,
}]
+ @classmethod
+ def suitable(cls, url):
+ return False if BBVTVIE.suitable(url) else super().suitable(url)
+
-class VTXTVIE(ZattooIE):
+class BBVTVRecordingsIE(BBVTVBaseIE):
+ _VALID_URL = _create_valid_url(BBVTVBaseIE._HOST, r'\d+', 'recording')
+ _TYPE = 'record'
+ _TESTS = [{
+ 'url': 'https://bbv-tv.net/recordings?recording=193615508',
+ 'only_matching': True,
+ }, {
+ 'url': 'https://bbv-tv.net/tc/ptc_recordings_all_recordings?recording=193615420',
+ 'only_matching': True,
+ }]
+
+
+class VTXTVBaseIE(ZattooPlatformBaseIE):
_NETRC_MACHINE = 'vtxtv'
_HOST = 'vtxtv.ch'
_API_HOST = 'www.%s' % _HOST
- _VALID_URL = _make_valid_url(ZattooIE._VALID_URL_TEMPLATE, _HOST)
+
+class VTXTVIE(VTXTVBaseIE):
+ _VALID_URL = _create_valid_url(VTXTVBaseIE._HOST, r'\d+', 'program', '(?:program|watch)/[^/]+')
+ _TYPE = 'video'
_TESTS = [{
- 'url': 'https://www.vtxtv.ch/watch/abc/123-abc',
+ 'url': 'https://vtxtv.ch/program/daserste/210177916',
+ 'only_matching': True,
+ }, {
+ 'url': 'https://vtxtv.ch/guide/german?channel=srf1&program=169860555',
'only_matching': True,
}]
-class MyVisionTVIE(ZattooIE):
- _NETRC_MACHINE = 'myvisiontv'
- _HOST = 'myvisiontv.ch'
- _API_HOST = 'www.%s' % _HOST
- _VALID_URL = _make_valid_url(ZattooIE._VALID_URL_TEMPLATE, _HOST)
+class VTXTVLiveIE(VTXTVBaseIE):
+ _VALID_URL = _create_valid_url(VTXTVBaseIE._HOST, r'[^/?&#]+', 'channel', 'live')
+ _TYPE = 'live'
+ _TESTS = [{
+ 'url': 'https://vtxtv.ch/channels/german?channel=srf_zwei',
+ 'only_matching': True,
+ }, {
+ 'url': 'https://vtxtv.ch/live/srf1',
+ 'only_matching': True,
+ }]
+
+ @classmethod
+ def suitable(cls, url):
+ return False if VTXTVIE.suitable(url) else super().suitable(url)
+
+class VTXTVRecordingsIE(VTXTVBaseIE):
+ _VALID_URL = _create_valid_url(VTXTVBaseIE._HOST, r'\d+', 'recording')
+ _TYPE = 'record'
_TESTS = [{
- 'url': 'https://www.myvisiontv.ch/watch/abc/123-abc',
+ 'url': 'https://vtxtv.ch/recordings?recording=193615508',
+ 'only_matching': True,
+ }, {
+ 'url': 'https://vtxtv.ch/tc/ptc_recordings_all_recordings?recording=193615420',
'only_matching': True,
}]
-class GlattvisionTVIE(ZattooIE):
+class GlattvisionTVBaseIE(ZattooPlatformBaseIE):
_NETRC_MACHINE = 'glattvisiontv'
_HOST = 'iptv.glattvision.ch'
- _VALID_URL = _make_valid_url(ZattooIE._VALID_URL_TEMPLATE, _HOST)
+
+class GlattvisionTVIE(GlattvisionTVBaseIE):
+ _VALID_URL = _create_valid_url(GlattvisionTVBaseIE._HOST, r'\d+', 'program', '(?:program|watch)/[^/]+')
+ _TYPE = 'video'
+ _TESTS = [{
+ 'url': 'https://iptv.glattvision.ch/program/daserste/210177916',
+ 'only_matching': True,
+ }, {
+ 'url': 'https://iptv.glattvision.ch/guide/german?channel=srf1&program=169860555',
+ 'only_matching': True,
+ }]
+
+
+class GlattvisionTVLiveIE(GlattvisionTVBaseIE):
+ _VALID_URL = _create_valid_url(GlattvisionTVBaseIE._HOST, r'[^/?&#]+', 'channel', 'live')
+ _TYPE = 'live'
+ _TESTS = [{
+ 'url': 'https://iptv.glattvision.ch/channels/german?channel=srf_zwei',
+ 'only_matching': True,
+ }, {
+ 'url': 'https://iptv.glattvision.ch/live/srf1',
+ 'only_matching': True,
+ }]
+
+ @classmethod
+ def suitable(cls, url):
+ return False if GlattvisionTVIE.suitable(url) else super().suitable(url)
+
+
+class GlattvisionTVRecordingsIE(GlattvisionTVBaseIE):
+ _VALID_URL = _create_valid_url(GlattvisionTVBaseIE._HOST, r'\d+', 'recording')
+ _TYPE = 'record'
_TESTS = [{
- 'url': 'https://iptv.glattvision.ch/watch/abc/123-abc',
+ 'url': 'https://iptv.glattvision.ch/recordings?recording=193615508',
+ 'only_matching': True,
+ }, {
+ 'url': 'https://iptv.glattvision.ch/tc/ptc_recordings_all_recordings?recording=193615420',
'only_matching': True,
}]
-class SAKTVIE(ZattooIE):
+class SAKTVBaseIE(ZattooPlatformBaseIE):
_NETRC_MACHINE = 'saktv'
_HOST = 'saktv.ch'
_API_HOST = 'www.%s' % _HOST
- _VALID_URL = _make_valid_url(ZattooIE._VALID_URL_TEMPLATE, _HOST)
+
+class SAKTVIE(SAKTVBaseIE):
+ _VALID_URL = _create_valid_url(SAKTVBaseIE._HOST, r'\d+', 'program', '(?:program|watch)/[^/]+')
+ _TYPE = 'video'
+ _TESTS = [{
+ 'url': 'https://saktv.ch/program/daserste/210177916',
+ 'only_matching': True,
+ }, {
+ 'url': 'https://saktv.ch/guide/german?channel=srf1&program=169860555',
+ 'only_matching': True,
+ }]
+
+
+class SAKTVLiveIE(SAKTVBaseIE):
+ _VALID_URL = _create_valid_url(SAKTVBaseIE._HOST, r'[^/?&#]+', 'channel', 'live')
+ _TYPE = 'live'
+ _TESTS = [{
+ 'url': 'https://saktv.ch/channels/german?channel=srf_zwei',
+ 'only_matching': True,
+ }, {
+ 'url': 'https://saktv.ch/live/srf1',
+ 'only_matching': True,
+ }]
+
+ @classmethod
+ def suitable(cls, url):
+ return False if SAKTVIE.suitable(url) else super().suitable(url)
+
+
+class SAKTVRecordingsIE(SAKTVBaseIE):
+ _VALID_URL = _create_valid_url(SAKTVBaseIE._HOST, r'\d+', 'recording')
+ _TYPE = 'record'
_TESTS = [{
- 'url': 'https://www.saktv.ch/watch/abc/123-abc',
+ 'url': 'https://saktv.ch/recordings?recording=193615508',
+ 'only_matching': True,
+ }, {
+ 'url': 'https://saktv.ch/tc/ptc_recordings_all_recordings?recording=193615420',
'only_matching': True,
}]
-class EWETVIE(ZattooIE):
+class EWETVBaseIE(ZattooPlatformBaseIE):
_NETRC_MACHINE = 'ewetv'
_HOST = 'tvonline.ewe.de'
- _VALID_URL = _make_valid_url(ZattooIE._VALID_URL_TEMPLATE, _HOST)
+
+class EWETVIE(EWETVBaseIE):
+ _VALID_URL = _create_valid_url(EWETVBaseIE._HOST, r'\d+', 'program', '(?:program|watch)/[^/]+')
+ _TYPE = 'video'
+ _TESTS = [{
+ 'url': 'https://tvonline.ewe.de/program/daserste/210177916',
+ 'only_matching': True,
+ }, {
+ 'url': 'https://tvonline.ewe.de/guide/german?channel=srf1&program=169860555',
+ 'only_matching': True,
+ }]
+
+
+class EWETVLiveIE(EWETVBaseIE):
+ _VALID_URL = _create_valid_url(EWETVBaseIE._HOST, r'[^/?&#]+', 'channel', 'live')
+ _TYPE = 'live'
+ _TESTS = [{
+ 'url': 'https://tvonline.ewe.de/channels/german?channel=srf_zwei',
+ 'only_matching': True,
+ }, {
+ 'url': 'https://tvonline.ewe.de/live/srf1',
+ 'only_matching': True,
+ }]
+
+ @classmethod
+ def suitable(cls, url):
+ return False if EWETVIE.suitable(url) else super().suitable(url)
+
+
+class EWETVRecordingsIE(EWETVBaseIE):
+ _VALID_URL = _create_valid_url(EWETVBaseIE._HOST, r'\d+', 'recording')
+ _TYPE = 'record'
_TESTS = [{
- 'url': 'https://tvonline.ewe.de/watch/abc/123-abc',
+ 'url': 'https://tvonline.ewe.de/recordings?recording=193615508',
+ 'only_matching': True,
+ }, {
+ 'url': 'https://tvonline.ewe.de/tc/ptc_recordings_all_recordings?recording=193615420',
'only_matching': True,
}]
-class QuantumTVIE(ZattooIE):
+class QuantumTVBaseIE(ZattooPlatformBaseIE):
_NETRC_MACHINE = 'quantumtv'
_HOST = 'quantum-tv.com'
_API_HOST = 'www.%s' % _HOST
- _VALID_URL = _make_valid_url(ZattooIE._VALID_URL_TEMPLATE, _HOST)
+
+class QuantumTVIE(QuantumTVBaseIE):
+ _VALID_URL = _create_valid_url(QuantumTVBaseIE._HOST, r'\d+', 'program', '(?:program|watch)/[^/]+')
+ _TYPE = 'video'
_TESTS = [{
- 'url': 'https://www.quantum-tv.com/watch/abc/123-abc',
+ 'url': 'https://quantum-tv.com/program/daserste/210177916',
+ 'only_matching': True,
+ }, {
+ 'url': 'https://quantum-tv.com/guide/german?channel=srf1&program=169860555',
'only_matching': True,
}]
-class OsnatelTVIE(ZattooIE):
+class QuantumTVLiveIE(QuantumTVBaseIE):
+ _VALID_URL = _create_valid_url(QuantumTVBaseIE._HOST, r'[^/?&#]+', 'channel', 'live')
+ _TYPE = 'live'
+ _TESTS = [{
+ 'url': 'https://quantum-tv.com/channels/german?channel=srf_zwei',
+ 'only_matching': True,
+ }, {
+ 'url': 'https://quantum-tv.com/live/srf1',
+ 'only_matching': True,
+ }]
+
+ @classmethod
+ def suitable(cls, url):
+ return False if QuantumTVIE.suitable(url) else super().suitable(url)
+
+
+class QuantumTVRecordingsIE(QuantumTVBaseIE):
+ _VALID_URL = _create_valid_url(QuantumTVBaseIE._HOST, r'\d+', 'recording')
+ _TYPE = 'record'
+ _TESTS = [{
+ 'url': 'https://quantum-tv.com/recordings?recording=193615508',
+ 'only_matching': True,
+ }, {
+ 'url': 'https://quantum-tv.com/tc/ptc_recordings_all_recordings?recording=193615420',
+ 'only_matching': True,
+ }]
+
+
+class OsnatelTVBaseIE(ZattooPlatformBaseIE):
_NETRC_MACHINE = 'osnateltv'
_HOST = 'tvonline.osnatel.de'
- _VALID_URL = _make_valid_url(ZattooIE._VALID_URL_TEMPLATE, _HOST)
+
+class OsnatelTVIE(OsnatelTVBaseIE):
+ _VALID_URL = _create_valid_url(OsnatelTVBaseIE._HOST, r'\d+', 'program', '(?:program|watch)/[^/]+')
+ _TYPE = 'video'
+ _TESTS = [{
+ 'url': 'https://tvonline.osnatel.de/program/daserste/210177916',
+ 'only_matching': True,
+ }, {
+ 'url': 'https://tvonline.osnatel.de/guide/german?channel=srf1&program=169860555',
+ 'only_matching': True,
+ }]
+
+
+class OsnatelTVLiveIE(OsnatelTVBaseIE):
+ _VALID_URL = _create_valid_url(OsnatelTVBaseIE._HOST, r'[^/?&#]+', 'channel', 'live')
+ _TYPE = 'live'
+ _TESTS = [{
+ 'url': 'https://tvonline.osnatel.de/channels/german?channel=srf_zwei',
+ 'only_matching': True,
+ }, {
+ 'url': 'https://tvonline.osnatel.de/live/srf1',
+ 'only_matching': True,
+ }]
+
+ @classmethod
+ def suitable(cls, url):
+ return False if OsnatelTVIE.suitable(url) else super().suitable(url)
+
+
+class OsnatelTVRecordingsIE(OsnatelTVBaseIE):
+ _VALID_URL = _create_valid_url(OsnatelTVBaseIE._HOST, r'\d+', 'recording')
+ _TYPE = 'record'
_TESTS = [{
- 'url': 'https://tvonline.osnatel.de/watch/abc/123-abc',
+ 'url': 'https://tvonline.osnatel.de/recordings?recording=193615508',
+ 'only_matching': True,
+ }, {
+ 'url': 'https://tvonline.osnatel.de/tc/ptc_recordings_all_recordings?recording=193615420',
'only_matching': True,
}]
-class EinsUndEinsTVIE(ZattooIE):
+class EinsUndEinsTVBaseIE(ZattooPlatformBaseIE):
_NETRC_MACHINE = '1und1tv'
_HOST = '1und1.tv'
_API_HOST = 'www.%s' % _HOST
- _VALID_URL = _make_valid_url(ZattooIE._VALID_URL_TEMPLATE, _HOST)
+
+class EinsUndEinsTVIE(EinsUndEinsTVBaseIE):
+ _VALID_URL = _create_valid_url(EinsUndEinsTVBaseIE._HOST, r'\d+', 'program', '(?:program|watch)/[^/]+')
+ _TYPE = 'video'
_TESTS = [{
- 'url': 'https://www.1und1.tv/watch/abc/123-abc',
+ 'url': 'https://1und1.tv/program/daserste/210177916',
+ 'only_matching': True,
+ }, {
+ 'url': 'https://1und1.tv/guide/german?channel=srf1&program=169860555',
'only_matching': True,
}]
-class SaltTVIE(ZattooIE):
+class EinsUndEinsTVLiveIE(EinsUndEinsTVBaseIE):
+ _VALID_URL = _create_valid_url(EinsUndEinsTVBaseIE._HOST, r'[^/?&#]+', 'channel', 'live')
+ _TYPE = 'live'
+ _TESTS = [{
+ 'url': 'https://1und1.tv/channels/german?channel=srf_zwei',
+ 'only_matching': True,
+ }, {
+ 'url': 'https://1und1.tv/live/srf1',
+ 'only_matching': True,
+ }]
+
+ @classmethod
+ def suitable(cls, url):
+ return False if EinsUndEinsTVIE.suitable(url) else super().suitable(url)
+
+
+class EinsUndEinsTVRecordingsIE(EinsUndEinsTVBaseIE):
+ _VALID_URL = _create_valid_url(EinsUndEinsTVBaseIE._HOST, r'\d+', 'recording')
+ _TYPE = 'record'
+ _TESTS = [{
+ 'url': 'https://1und1.tv/recordings?recording=193615508',
+ 'only_matching': True,
+ }, {
+ 'url': 'https://1und1.tv/tc/ptc_recordings_all_recordings?recording=193615420',
+ 'only_matching': True,
+ }]
+
+
+class SaltTVBaseIE(ZattooPlatformBaseIE):
_NETRC_MACHINE = 'salttv'
_HOST = 'tv.salt.ch'
- _VALID_URL = _make_valid_url(ZattooIE._VALID_URL_TEMPLATE, _HOST)
+
+class SaltTVIE(SaltTVBaseIE):
+ _VALID_URL = _create_valid_url(SaltTVBaseIE._HOST, r'\d+', 'program', '(?:program|watch)/[^/]+')
+ _TYPE = 'video'
_TESTS = [{
- 'url': 'https://tv.salt.ch/watch/abc/123-abc',
+ 'url': 'https://tv.salt.ch/program/daserste/210177916',
+ 'only_matching': True,
+ }, {
+ 'url': 'https://tv.salt.ch/guide/german?channel=srf1&program=169860555',
+ 'only_matching': True,
+ }]
+
+
+class SaltTVLiveIE(SaltTVBaseIE):
+ _VALID_URL = _create_valid_url(SaltTVBaseIE._HOST, r'[^/?&#]+', 'channel', 'live')
+ _TYPE = 'live'
+ _TESTS = [{
+ 'url': 'https://tv.salt.ch/channels/german?channel=srf_zwei',
+ 'only_matching': True,
+ }, {
+ 'url': 'https://tv.salt.ch/live/srf1',
+ 'only_matching': True,
+ }]
+
+ @classmethod
+ def suitable(cls, url):
+ return False if SaltTVIE.suitable(url) else super().suitable(url)
+
+
+class SaltTVRecordingsIE(SaltTVBaseIE):
+ _VALID_URL = _create_valid_url(SaltTVBaseIE._HOST, r'\d+', 'recording')
+ _TYPE = 'record'
+ _TESTS = [{
+ 'url': 'https://tv.salt.ch/recordings?recording=193615508',
+ 'only_matching': True,
+ }, {
+ 'url': 'https://tv.salt.ch/tc/ptc_recordings_all_recordings?recording=193615420',
'only_matching': True,
}]