)
-class VGTVIE(XstreamIE):
+class VGTVIE(XstreamIE): # XXX: Do not subclass from concrete IE
IE_DESC = 'VGTV, BTTV, FTV, Aftenposten and Aftonbladet'
_GEO_BYPASS = False
_VALID_URL = r'''(?x)
(?:https?://(?:www\.)?
(?P<host>
- %s
+ {}
)
/?
(?:
a(?:rticles)?/
)|
(?P<appname>
- %s
+ {}
):)
(?P<id>\d+)
- ''' % ('|'.join(_HOST_TO_APPNAME.keys()), '|'.join(_APP_NAME_TO_VENDOR.keys()))
+ '''.format('|'.join(_HOST_TO_APPNAME.keys()), '|'.join(_APP_NAME_TO_VENDOR.keys()))
_TESTS = [
{
vendor = self._APP_NAME_TO_VENDOR[appname]
data = self._download_json(
- 'http://svp.vg.no/svp/api/v1/%s/assets/%s?appName=%s-website'
- % (vendor, video_id, appname),
+ f'http://svp.vg.no/svp/api/v1/{vendor}/assets/{video_id}?appName={appname}-website',
video_id, 'Downloading media JSON')
if data.get('status') == 'inactive':
raise ExtractorError(
- 'Video %s is no longer available' % video_id, expected=True)
+ f'Video {video_id} is no longer available', expected=True)
info = {
'formats': [],
if hds_url:
hdcore_sign = 'hdcore=3.7.0'
f4m_formats = self._extract_f4m_formats(
- hds_url + '?%s' % hdcore_sign, video_id, f4m_id='hds', fatal=False)
+ hds_url + f'?{hdcore_sign}', video_id, f4m_id='hds', fatal=False)
if f4m_formats:
for entry in f4m_formats:
# URLs without the extra param induce an 404 error
'width': int(mobj.group(1)),
'height': int(mobj.group(2)),
'tbr': tbr,
- 'format_id': 'mp4-%s' % tbr,
+ 'format_id': f'mp4-{tbr}',
})
formats.append(format_info)
raise self.raise_geo_restricted(
countries=[host.rpartition('.')[-1].partition('/')[0].upper()])
- self._sort_formats(info['formats'])
-
info.update({
'id': video_id,
'title': data['title'],
webpage = self._download_webpage(url, self._match_id(url))
video_id = self._search_regex(
r'<video[^>]+data-id="(\d+)"', webpage, 'video id')
- return self.url_result('bttv:%s' % video_id, 'VGTV')
+ return self.url_result(f'bttv:{video_id}', 'VGTV')
class BTVestlendingenIE(InfoExtractor):
}]
def _real_extract(self, url):
- return self.url_result('bttv:%s' % self._match_id(url), 'VGTV')
+ return self.url_result(f'bttv:{self._match_id(url)}', 'VGTV')