]> jfr.im git - yt-dlp.git/blame - youtube_dl/downloader/__init__.py
Merge pull request #8611 from remitamine/ffmpegfd
[yt-dlp.git] / youtube_dl / downloader / __init__.py
CommitLineData
db1f3888
PH
1from __future__ import unicode_literals
2
3bc2ddcc 3from .common import FileDownloader
222516d9 4from .f4m import F4mFD
3bc2ddcc
JMF
5from .hls import HlsFD
6from .http import HttpFD
3bc2ddcc 7from .rtmp import RtmpFD
b9258c61 8from .dash import DashSegmentsFD
be24916a 9from .rtsp import RtspFD
12b84ac8 10from .external import (
11 get_external_downloader,
12 FFmpegFD,
13)
3bc2ddcc
JMF
14
15from ..utils import (
a055469f 16 determine_protocol,
3bc2ddcc
JMF
17)
18
a055469f
PH
19PROTOCOL_MAP = {
20 'rtmp': RtmpFD,
12b84ac8 21 'm3u8_native': HlsFD,
22 'm3u8': FFmpegFD,
be24916a 23 'mms': RtspFD,
24 'rtsp': RtspFD,
a055469f 25 'f4m': F4mFD,
423d2be5 26 'http_dash_segments': DashSegmentsFD,
a055469f 27}
f89197d7 28
a055469f
PH
29
30def get_suitable_downloader(info_dict, params={}):
3bc2ddcc 31 """Get the downloader class that can handle the info dict."""
a055469f
PH
32 protocol = determine_protocol(info_dict)
33 info_dict['protocol'] = protocol
34
6ae27bed 35 # 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):
da1973a0 36 # return FFmpegFD
12b84ac8 37
222516d9
PH
38 external_downloader = params.get('external_downloader')
39 if external_downloader is not None:
40 ed = get_external_downloader(external_downloader)
2cb99ebb 41 if ed.can_download(info_dict):
222516d9
PH
42 return ed
43
85729c51 44 if protocol == 'm3u8' and params.get('hls_prefer_native'):
12b84ac8 45 return HlsFD
85729c51 46
a055469f
PH
47 return PROTOCOL_MAP.get(protocol, HttpFD)
48
14d4e90e
PH
49
50__all__ = [
51 'get_suitable_downloader',
52 'FileDownloader',
53]