|
|
@ -57,29 +57,26 @@ class SRGSSRIE(InfoExtractor):
|
|
|
|
formats = []
|
|
|
|
formats = []
|
|
|
|
for source in media_data.get('Playlists', {}).get('Playlist', []) + media_data.get('Downloads', {}).get('Download', []):
|
|
|
|
for source in media_data.get('Playlists', {}).get('Playlist', []) + media_data.get('Downloads', {}).get('Download', []):
|
|
|
|
protocol = source.get('@protocol')
|
|
|
|
protocol = source.get('@protocol')
|
|
|
|
if protocol in ('HTTP-HDS', 'HTTP-HLS'):
|
|
|
|
for asset in source['url']:
|
|
|
|
assets = {}
|
|
|
|
asset_url = asset['text']
|
|
|
|
for quality in source['url']:
|
|
|
|
quality = asset['@quality']
|
|
|
|
assets[quality['@quality']] = quality['text']
|
|
|
|
format_id = '%s-%s' % (protocol, quality)
|
|
|
|
asset_url = assets.get('HD') or assets.get('HQ') or assets.get('SD') or assets.get('MQ') or assets.get('LQ')
|
|
|
|
if protocol == 'HTTP-HDS':
|
|
|
|
if '.f4m' in asset_url:
|
|
|
|
|
|
|
|
formats.extend(self._extract_f4m_formats(
|
|
|
|
formats.extend(self._extract_f4m_formats(
|
|
|
|
asset_url + '?hdcore=3.4.0', media_id,
|
|
|
|
asset_url + '?hdcore=3.4.0', media_id,
|
|
|
|
f4m_id='hds', fatal=False))
|
|
|
|
f4m_id=format_id, fatal=False))
|
|
|
|
elif '.m3u8' in asset_url:
|
|
|
|
elif protocol == 'HTTP-HLS':
|
|
|
|
formats.extend(self._extract_m3u8_formats(
|
|
|
|
formats.extend(self._extract_m3u8_formats(
|
|
|
|
asset_url, media_id, 'mp4', 'm3u8_native',
|
|
|
|
asset_url, media_id, 'mp4', 'm3u8_native',
|
|
|
|
m3u8_id='hls', fatal=False))
|
|
|
|
m3u8_id=format_id, fatal=False))
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
for asset in source['url']:
|
|
|
|
|
|
|
|
asset_url = asset['text']
|
|
|
|
|
|
|
|
ext = None
|
|
|
|
ext = None
|
|
|
|
if asset_url.startswith('rtmp'):
|
|
|
|
if protocol == 'RTMP':
|
|
|
|
ext = self._search_regex(r'([a-z0-9]+):[^/]+', asset_url, 'ext')
|
|
|
|
ext = self._search_regex(r'([a-z0-9]+):[^/]+', asset_url, 'ext')
|
|
|
|
formats.append({
|
|
|
|
formats.append({
|
|
|
|
'format_id': asset['@quality'],
|
|
|
|
'format_id': format_id,
|
|
|
|
'url': asset_url,
|
|
|
|
'url': asset_url,
|
|
|
|
'preference': preference(asset['@quality']),
|
|
|
|
'preference': preference(quality),
|
|
|
|
'ext': ext,
|
|
|
|
'ext': ext,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
self._sort_formats(formats)
|
|
|
|
self._sort_formats(formats)
|
|
|
|