]>
jfr.im git - yt-dlp.git/blob - youtube_dl/downloader/__init__.py
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 .youtube_live_chat
import YoutubeLiveChatReplayFD
12 from .external
import (
13 get_external_downloader
,
28 'http_dash_segments': DashSegmentsFD
,
30 'youtube_live_chat_replay': YoutubeLiveChatReplayFD
,
34 def get_suitable_downloader(info_dict
, params
={}):
35 """Get the downloader class that can handle the info dict."""
36 protocol
= determine_protocol(info_dict
)
37 info_dict
['protocol'] = protocol
39 # 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):
42 external_downloader
= params
.get('external_downloader')
43 if external_downloader
is not None:
44 ed
= get_external_downloader(external_downloader
)
45 if ed
.can_download(info_dict
):
48 if protocol
.startswith('m3u8') and info_dict
.get('is_live'):
51 if protocol
== 'm3u8' and params
.get('hls_prefer_native') is True:
54 if protocol
== 'm3u8_native' and params
.get('hls_prefer_native') is False:
57 return PROTOCOL_MAP
.get(protocol
, HttpFD
)
61 'get_suitable_downloader',