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 .rtsp import RtspFD
10 from .ism import IsmFD
11 from .external import (
12 get_external_downloader,
27 'http_dash_segments': DashSegmentsFD,
32 def get_suitable_downloader(info_dict, params={}):
33 """Get the downloader class that can handle the info dict."""
34 protocol = determine_protocol(info_dict)
35 info_dict['protocol'] = protocol
37 # 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):
40 external_downloader = params.get('external_downloader')
41 if external_downloader is not None:
42 ed = get_external_downloader(external_downloader)
43 if ed.can_download(info_dict):
46 if protocol == 'm3u8' and params.get('hls_prefer_native') is True:
49 if protocol == 'm3u8_native' and params.get('hls_prefer_native') is False:
52 return PROTOCOL_MAP.get(protocol, HttpFD)
56 'get_suitable_downloader',