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