1 from __future__ import unicode_literals
3 from .common import FileDownloader
6 from .http import HttpFD
7 from .rtmp import RtmpFD
8 from .dash import DashSegmentsFD
9 from .external import (
10 get_external_downloader,
25 'http_dash_segments': DashSegmentsFD,
29 def get_suitable_downloader(info_dict, params={}):
30 """Get the downloader class that can handle the info dict."""
31 protocol = determine_protocol(info_dict)
32 info_dict['protocol'] = protocol
34 if (info_dict.get('start_time') or info_dict.get('end_time')) and FFmpegFD.can_download(info_dict):
37 external_downloader = params.get('external_downloader')
38 if external_downloader is not None:
39 ed = get_external_downloader(external_downloader)
40 if ed.can_download(info_dict):
43 if protocol == 'm3u8' and params.get('hls_prefer_native'):
46 return PROTOCOL_MAP.get(protocol, HttpFD)
50 'get_suitable_downloader',