Skip to content

Commit 03e3b4e

Browse files
remitaminedstftw
authored andcommitted
[expotv] parse m3u8 manifest
1 parent d8348c3 commit 03e3b4e

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

youtube_dl/extractor/expotv.py

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,20 +33,24 @@ def _real_extract(self, url):
3333
webpage = self._download_webpage(url, video_id)
3434
player_key = self._search_regex(
3535
r'<param name="playerKey" value="([^"]+)"', webpage, 'player key')
36-
config_url = 'http://client.expotv.com/video/config/%s/%s' % (
37-
video_id, player_key)
3836
config = self._download_json(
39-
config_url, video_id,
40-
note='Downloading video configuration')
37+
'http://client.expotv.com/video/config/%s/%s' % (video_id, player_key),
38+
video_id,
39+
note='Downloading video configuration')
4140

42-
formats = [{
43-
'url': fcfg['file'],
44-
'height': int_or_none(fcfg.get('height')),
45-
'format_note': fcfg.get('label'),
46-
'ext': self._search_regex(
47-
r'filename=.*\.([a-z0-9_A-Z]+)&', fcfg['file'],
48-
'file extension', default=None),
49-
} for fcfg in config['sources']]
41+
formats = []
42+
for fcfg in config['sources']:
43+
if fcfg['type'] == 'm3u8':
44+
formats.extend(self._extract_m3u8_formats(fcfg['file'], video_id))
45+
else:
46+
formats.append({
47+
'url': fcfg['file'],
48+
'height': int_or_none(fcfg.get('height')),
49+
'format_id': fcfg.get('label'),
50+
'ext': self._search_regex(
51+
r'filename=.*\.([a-z0-9_A-Z]+)&', fcfg['file'],
52+
'file extension', default=None),
53+
})
5054
self._sort_formats(formats)
5155

5256
title = self._og_search_title(webpage)

0 commit comments

Comments
 (0)