Skip to content

Commit

Permalink
[expotv] parse m3u8 manifest
Browse files Browse the repository at this point in the history
  • Loading branch information
remitamine authored and dstftw committed Oct 11, 2015
1 parent d8348c3 commit 03e3b4e
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions youtube_dl/extractor/expotv.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,24 @@ def _real_extract(self, url):
webpage = self._download_webpage(url, video_id)
player_key = self._search_regex(
r'<param name="playerKey" value="([^"]+)"', webpage, 'player key')
config_url = 'http://client.expotv.com/video/config/%s/%s' % (
video_id, player_key)
config = self._download_json(
config_url, video_id,
note='Downloading video configuration')
'http://client.expotv.com/video/config/%s/%s' % (video_id, player_key),
video_id,
note='Downloading video configuration')

formats = [{
'url': fcfg['file'],
'height': int_or_none(fcfg.get('height')),
'format_note': fcfg.get('label'),
'ext': self._search_regex(
r'filename=.*\.([a-z0-9_A-Z]+)&', fcfg['file'],
'file extension', default=None),
} for fcfg in config['sources']]
formats = []
for fcfg in config['sources']:
if fcfg['type'] == 'm3u8':
formats.extend(self._extract_m3u8_formats(fcfg['file'], video_id))
else:
formats.append({
'url': fcfg['file'],
'height': int_or_none(fcfg.get('height')),
'format_id': fcfg.get('label'),
'ext': self._search_regex(
r'filename=.*\.([a-z0-9_A-Z]+)&', fcfg['file'],
'file extension', default=None),
})
self._sort_formats(formats)

title = self._og_search_title(webpage)
Expand Down

0 comments on commit 03e3b4e

Please sign in to comment.