aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/downloader
diff options
context:
space:
mode:
authorRemita Amine <remitamine@gmail.com>2017-03-25 19:37:54 +0100
committerRemita Amine <remitamine@gmail.com>2017-03-25 19:38:23 +0100
commitfb4fc44928d042a33287fd3e8e18b721c29ff8e8 (patch)
treeeebce170ea4942ea6ff0c23f1ee306da09ca288e /youtube_dl/downloader
parent51ef4919dfd51b5bd562f39f865a117f9a5cd304 (diff)
[downloader/hls] immediately delegate downloading to ffmpeg in case live stream
Diffstat (limited to 'youtube_dl/downloader')
-rw-r--r--youtube_dl/downloader/hls.py21
1 files changed, 13 insertions, 8 deletions
diff --git a/youtube_dl/downloader/hls.py b/youtube_dl/downloader/hls.py
index 4989abce1..7534e4da5 100644
--- a/youtube_dl/downloader/hls.py
+++ b/youtube_dl/downloader/hls.py
@@ -30,6 +30,15 @@ class HlsFD(FragmentFD):
FD_NAME = 'hlsnative'
+ def _delegate_to_ffmpeg(self, filename, info_dict):
+ self.report_warning(
+ 'hlsnative has detected features it does not support, '
+ 'extraction will be delegated to ffmpeg')
+ fd = FFmpegFD(self.ydl, self.params)
+ for ph in self._progress_hooks:
+ fd.add_progress_hook(ph)
+ return fd.real_download(filename, info_dict)
+
@staticmethod
def can_download(manifest, info_dict):
UNSUPPORTED_FEATURES = (
@@ -53,10 +62,12 @@ class HlsFD(FragmentFD):
)
check_results = [not re.search(feature, manifest) for feature in UNSUPPORTED_FEATURES]
check_results.append(can_decrypt_frag or '#EXT-X-KEY:METHOD=AES-128' not in manifest)
- check_results.append(not info_dict.get('is_live'))
return all(check_results)
def real_download(self, filename, info_dict):
+ if info_dict.get('is_live'):
+ return self._delegate_to_ffmpeg(filename, info_dict)
+
man_url = info_dict['url']
self.to_screen('[%s] Downloading m3u8 manifest' % self.FD_NAME)
@@ -68,13 +79,7 @@ class HlsFD(FragmentFD):
if info_dict.get('extra_param_to_segment_url'):
self.report_error('pycrypto not found. Please install it.')
return False
- self.report_warning(
- 'hlsnative has detected features it does not support, '
- 'extraction will be delegated to ffmpeg')
- fd = FFmpegFD(self.ydl, self.params)
- for ph in self._progress_hooks:
- fd.add_progress_hook(ph)
- return fd.real_download(filename, info_dict)
+ return self._delegate_to_ffmpeg(filename, info_dict)
total_frags = 0
for line in s.splitlines():