1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-11-26 18:34:32 +01:00

[bild] Make more robust and improve hls extraction

This commit is contained in:
Sergey M․ 2015-10-11 19:28:00 +06:00
parent 03e3b4e119
commit 7d49502ab0

View File

@ -35,21 +35,24 @@ class ExpoTVIE(InfoExtractor):
r'<param name="playerKey" value="([^"]+)"', webpage, 'player key') r'<param name="playerKey" value="([^"]+)"', webpage, 'player key')
config = self._download_json( config = self._download_json(
'http://client.expotv.com/video/config/%s/%s' % (video_id, player_key), 'http://client.expotv.com/video/config/%s/%s' % (video_id, player_key),
video_id, video_id, 'Downloading video configuration')
note='Downloading video configuration')
formats = [] formats = []
for fcfg in config['sources']: for fcfg in config['sources']:
if fcfg['type'] == 'm3u8': media_url = fcfg.get('file')
formats.extend(self._extract_m3u8_formats(fcfg['file'], video_id)) if not media_url:
continue
if fcfg.get('type') == 'm3u8':
formats.extend(self._extract_m3u8_formats(
media_url, video_id, 'mp4', entry_protocol='m3u8_native', m3u8_id='hls'))
else: else:
formats.append({ formats.append({
'url': fcfg['file'], 'url': media_url,
'height': int_or_none(fcfg.get('height')), 'height': int_or_none(fcfg.get('height')),
'format_id': fcfg.get('label'), 'format_id': fcfg.get('label'),
'ext': self._search_regex( 'ext': self._search_regex(
r'filename=.*\.([a-z0-9_A-Z]+)&', fcfg['file'], r'filename=.*\.([a-z0-9_A-Z]+)&', media_url,
'file extension', default=None), 'file extension', default=None) or fcfg.get('type'),
}) })
self._sort_formats(formats) self._sort_formats(formats)