diff options
author | pukkandan <pukkandan.ytdlp@gmail.com> | 2022-06-26 04:10:04 +0530 |
---|---|---|
committer | pukkandan <pukkandan.ytdlp@gmail.com> | 2022-06-26 04:48:41 +0530 |
commit | bbae4377237f7535a738ae94b40dc6f76872f47b (patch) | |
tree | 7d1e06bd6e62ddd933151070500aecf56d72399b | |
parent | 30d22d775bc9abdbd301132b6cb7a57badb796dc (diff) | |
download | hypervideo-pre-bbae4377237f7535a738ae94b40dc6f76872f47b.tar.lz hypervideo-pre-bbae4377237f7535a738ae94b40dc6f76872f47b.tar.xz hypervideo-pre-bbae4377237f7535a738ae94b40dc6f76872f47b.zip |
[hls] Warn user when trying to download live HLS
We do not automatically switch to ffmpeg because the detection is not 100% accurate
-rw-r--r-- | yt_dlp/downloader/hls.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/yt_dlp/downloader/hls.py b/yt_dlp/downloader/hls.py index d93d00f12..1e75c5e9c 100644 --- a/yt_dlp/downloader/hls.py +++ b/yt_dlp/downloader/hls.py @@ -61,12 +61,18 @@ class HlsFD(FragmentFD): s = urlh.read().decode('utf-8', 'ignore') can_download, message = self.can_download(s, info_dict, self.params.get('allow_unplayable_formats')), None - if can_download and not Cryptodome_AES and '#EXT-X-KEY:METHOD=AES-128' in s: - if FFmpegFD.available(): + if can_download: + has_ffmpeg = FFmpegFD.available() + no_crypto = not Cryptodome_AES and '#EXT-X-KEY:METHOD=AES-128' in s + if no_crypto and has_ffmpeg: can_download, message = False, 'The stream has AES-128 encryption and pycryptodomex is not available' - else: + elif no_crypto: message = ('The stream has AES-128 encryption and neither ffmpeg nor pycryptodomex are available; ' 'Decryption will be performed natively, but will be extremely slow') + elif re.search(r'#EXT-X-MEDIA-SEQUENCE:(?!0$)', s): + install_ffmpeg = '' if has_ffmpeg else 'install ffmpeg and ' + message = ('Live HLS streams are not supported by the native downloader. If this is a livestream, ' + f'please {install_ffmpeg}add "--downloader ffmpeg --hls-use-mpegts" to your command') if not can_download: has_drm = re.search('|'.join([ r'#EXT-X-FAXS-CM:', # Adobe Flash Access |