From 79a1c9c91838f403b8fe7b60af5e0562f48af944 Mon Sep 17 00:00:00 2001 From: Maxime-J Date: Wed, 4 May 2016 20:54:53 +0200 Subject: [PATCH] [Downloader] --hls-prefer-ffmpeg fix --- youtube_dl/downloader/__init__.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/youtube_dl/downloader/__init__.py b/youtube_dl/downloader/__init__.py index 817591d97..780d88f37 100644 --- a/youtube_dl/downloader/__init__.py +++ b/youtube_dl/downloader/__init__.py @@ -30,6 +30,10 @@ PROTOCOL_MAP = { def get_suitable_downloader(info_dict, params={}): """Get the downloader class that can handle the info dict.""" protocol = determine_protocol(info_dict) + if protocol == 'm3u8' and params.get('hls_prefer_native') is True: + protocol = 'm3u8_native' + elif protocol == 'm3u8_native' and params.get('hls_prefer_native') is False: + protocol = 'm3u8' info_dict['protocol'] = protocol # if (info_dict.get('start_time') or info_dict.get('end_time')) and not info_dict.get('requested_formats') and FFmpegFD.can_download(info_dict): @@ -41,12 +45,6 @@ def get_suitable_downloader(info_dict, params={}): if ed.can_download(info_dict): return ed - if protocol == 'm3u8' and params.get('hls_prefer_native') is True: - return HlsFD - - if protocol == 'm3u8_native' and params.get('hls_prefer_native') is False: - return FFmpegFD - return PROTOCOL_MAP.get(protocol, HttpFD)