]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/downloader/__init__.py
eff1122c5c09eff494ad34af835b06e33c9e4751
[youtubedl] / youtube_dl / downloader / __init__.py
1 from __future__ import unicode_literals
2
3 from .common import FileDownloader
4 from .external import get_external_downloader
5 from .f4m import F4mFD
6 from .hls import HlsFD
7 from .hls import NativeHlsFD
8 from .http import HttpFD
9 from .mplayer import MplayerFD
10 from .rtmp import RtmpFD
11
12 from ..utils import (
13 determine_protocol,
14 )
15
16 PROTOCOL_MAP = {
17 'rtmp': RtmpFD,
18 'm3u8_native': NativeHlsFD,
19 'm3u8': HlsFD,
20 'mms': MplayerFD,
21 'rtsp': MplayerFD,
22 'f4m': F4mFD,
23 }
24
25
26 def get_suitable_downloader(info_dict, params={}):
27 """Get the downloader class that can handle the info dict."""
28 protocol = determine_protocol(info_dict)
29 info_dict['protocol'] = protocol
30
31 external_downloader = params.get('external_downloader')
32 if external_downloader is not None:
33 ed = get_external_downloader(external_downloader)
34 if ed.supports(info_dict):
35 return ed
36
37 return PROTOCOL_MAP.get(protocol, HttpFD)
38
39
40 __all__ = [
41 'get_suitable_downloader',
42 'FileDownloader',
43 ]