diff options
author | Sergey M․ <[email protected]> | 2017-08-16 23:03:42 +0700 |
---|---|---|
committer | Sergey M․ <[email protected]> | 2017-08-16 23:03:42 +0700 |
commit | a1aa6596626a98d068780f092367b87398840c47 (patch) | |
tree | 85f80bf3376f4dd10ab318a2bc65dfebcbb65cce /youtube_dl/extractor/periscope.py | |
parent | 485047854376465f95309daad4966971f56728ef (diff) | |
download | youtube-dl-a1aa6596626a98d068780f092367b87398840c47.tar.gz youtube-dl-a1aa6596626a98d068780f092367b87398840c47.zip |
[periscope] Renew HLS extraction (closes #13917)
Diffstat (limited to 'youtube_dl/extractor/periscope.py')
-rw-r--r-- | youtube_dl/extractor/periscope.py | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/youtube_dl/extractor/periscope.py b/youtube_dl/extractor/periscope.py index bfa12edc9..e5e08538c 100644 --- a/youtube_dl/extractor/periscope.py +++ b/youtube_dl/extractor/periscope.py @@ -80,18 +80,24 @@ class PeriscopeIE(PeriscopeBaseIE): stream = self._call_api( 'getAccessPublic', {'broadcast_id': token}, token) + video_urls = set() formats = [] - for format_id in ('replay', 'rtmp', 'hls', 'https_hls'): + for format_id in ('replay', 'rtmp', 'hls', 'https_hls', 'lhls', 'lhlsweb'): video_url = stream.get(format_id + '_url') - if not video_url: + if not video_url or video_url in video_urls: continue - f = { + video_urls.add(video_url) + if format_id != 'rtmp': + formats.extend(self._extract_m3u8_formats( + video_url, token, 'mp4', + entry_protocol='m3u8_native' + if state in ('ended', 'timed_out') else 'm3u8', + m3u8_id=format_id, fatal=False)) + continue + formats.append({ 'url': video_url, 'ext': 'flv' if format_id == 'rtmp' else 'mp4', - } - if format_id != 'rtmp': - f['protocol'] = 'm3u8_native' if state in ('ended', 'timed_out') else 'm3u8' - formats.append(f) + }) self._sort_formats(formats) return { |