]>
jfr.im git - yt-dlp.git/blob - yt_dlp/downloader/__init__.py
1 from __future__
import unicode_literals
8 def _get_real_downloader(info_dict
, protocol
=None, *args
, **kwargs
):
9 info_copy
= info_dict
.copy()
11 info_copy
['protocol'] = protocol
12 return get_suitable_downloader(info_copy
, *args
, **kwargs
)
15 # Some of these require _get_real_downloader
16 from .common
import FileDownloader
17 from .dash
import DashSegmentsFD
18 from .f4m
import F4mFD
19 from .hls
import HlsFD
20 from .http
import HttpFD
21 from .rtmp
import RtmpFD
22 from .rtsp
import RtspFD
23 from .ism
import IsmFD
24 from .niconico
import NiconicoDmcFD
25 from .youtube_live_chat
import YoutubeLiveChatReplayFD
26 from .external
import (
27 get_external_downloader
,
38 'http_dash_segments': DashSegmentsFD
,
40 'niconico_dmc': NiconicoDmcFD
,
41 'youtube_live_chat_replay': YoutubeLiveChatReplayFD
,
45 def get_suitable_downloader(info_dict
, params
={}, default
=HttpFD
):
46 """Get the downloader class that can handle the info dict."""
47 protocol
= determine_protocol(info_dict
)
48 info_dict
['protocol'] = protocol
50 # 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):
53 external_downloader
= params
.get('external_downloader')
54 if external_downloader
is not None:
55 ed
= get_external_downloader(external_downloader
)
56 if ed
.can_download(info_dict
, external_downloader
):
59 if protocol
.startswith('m3u8'):
60 if info_dict
.get('is_live'):
62 elif _get_real_downloader(info_dict
, 'frag_urls', params
, None):
64 elif params
.get('hls_prefer_native') is True:
66 elif params
.get('hls_prefer_native') is False:
69 return PROTOCOL_MAP
.get(protocol
, default
)
73 'get_suitable_downloader',