-# coding: utf-8
-from __future__ import unicode_literals
-
import re
from .srgssr import SRGSSRIE
-from ..compat import compat_str
from ..utils import (
determine_ext,
int_or_none,
)
-class RTSIE(SRGSSRIE):
+class RTSIE(SRGSSRIE): # XXX: Do not subclass from concrete IE
+ _WORKING = False
IE_DESC = 'RTS.ch'
_VALID_URL = r'rts:(?P<rts_id>\d+)|https?://(?:.+?\.)?rts\.ch/(?:[^/]+/){2,}(?P<id>[0-9]+)-(?P<display_id>.+?)\.html'
{
'url': 'http://pages.rts.ch/emissions/passe-moi-les-jumelles/5624065-entre-ciel-et-mer.html',
'only_matching': True,
- }
+ },
]
def _real_extract(self, url):
- m = re.match(self._VALID_URL, url)
+ m = self._match_valid_url(url)
media_id = m.group('rts_id') or m.group('id')
display_id = m.group('display_id') or media_id
def download_json(internal_id):
return self._download_json(
- 'http://www.rts.ch/a/%s.html?f=json/article' % internal_id,
+ f'http://www.rts.ch/a/{internal_id}.html?f=json/article',
display_id)
all_info = download_json(media_id)
if not entries:
page, urlh = self._download_webpage_handle(url, display_id)
- if re.match(self._VALID_URL, urlh.geturl()).group('id') != media_id:
- return self.url_result(urlh.geturl(), 'RTS')
+ if re.match(self._VALID_URL, urlh.url).group('id') != media_id:
+ return self.url_result(urlh.url, 'RTS')
# article with videos on rhs
videos = re.findall(
r'(?s)<iframe[^>]+class="srg-player"[^>]+src="[^"]+urn:([^"]+)"',
page)
if videos:
- entries = [self.url_result('srgssr:%s' % video_urn, 'SRGSSR') for video_urn in videos]
+ entries = [self.url_result(f'srgssr:{video_urn}', 'SRGSSR') for video_urn in videos]
if entries:
return self.playlist_result(entries, media_id, all_info.get('title'))
'tbr': extract_bitrate(format_url),
})
- download_base = 'http://rtsww%s-d.rts.ch/' % ('-a' if media_type == 'audio' else '')
+ download_base = 'http://rtsww{}-d.rts.ch/'.format('-a' if media_type == 'audio' else '')
for media in info.get('media', []):
media_url = media.get('url')
if not media_url or re.match(r'https?://', media_url):
})
self._check_formats(formats, media_id)
- self._sort_formats(formats)
duration = info.get('duration') or info.get('cutout') or info.get('cutduration')
- if isinstance(duration, compat_str):
+ if isinstance(duration, str):
duration = parse_duration(duration)
return {