diff options
author | Sergey M․ <dstftw@gmail.com> | 2015-10-11 19:28:00 +0600 |
---|---|---|
committer | Sergey M․ <dstftw@gmail.com> | 2015-10-11 19:28:00 +0600 |
commit | 7d49502ab0990972bdb479e6bf32dbc8ffdb3e1c (patch) | |
tree | d5d1dfb2d9157d191eeedfb191d43a61cde0da48 /youtube_dl/extractor | |
parent | 03e3b4e1198631b30914e8669b01bf1825a4385c (diff) |
[bild] Make more robust and improve hls extraction
Diffstat (limited to 'youtube_dl/extractor')
-rw-r--r-- | youtube_dl/extractor/expotv.py | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/youtube_dl/extractor/expotv.py b/youtube_dl/extractor/expotv.py index 23a38c7c1..1585a03bb 100644 --- a/youtube_dl/extractor/expotv.py +++ b/youtube_dl/extractor/expotv.py @@ -34,22 +34,25 @@ class ExpoTVIE(InfoExtractor): player_key = self._search_regex( r'<param name="playerKey" value="([^"]+)"', webpage, 'player key') config = self._download_json( - 'http://client.expotv.com/video/config/%s/%s' % (video_id, player_key), - video_id, - note='Downloading video configuration') + 'http://client.expotv.com/video/config/%s/%s' % (video_id, player_key), + video_id, 'Downloading video configuration') formats = [] for fcfg in config['sources']: - if fcfg['type'] == 'm3u8': - formats.extend(self._extract_m3u8_formats(fcfg['file'], video_id)) + media_url = fcfg.get('file') + 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: formats.append({ - 'url': fcfg['file'], + 'url': media_url, '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), + r'filename=.*\.([a-z0-9_A-Z]+)&', media_url, + 'file extension', default=None) or fcfg.get('type'), }) self._sort_formats(formats) |