Merge remote-tracking branch 'sahutd/master'
[youtube-dl] / youtube_dl / downloader / __init__.py
1 from __future__ import unicode_literals
2
3 from .common import FileDownloader
4 from .hls import HlsFD
5 from .http import HttpFD
6 from .mplayer import MplayerFD
7 from .rtmp import RtmpFD
8
9 from ..utils import (
10     determine_ext,
11 )
12
13
14 def get_suitable_downloader(info_dict):
15     """Get the downloader class that can handle the info dict."""
16     url = info_dict['url']
17     protocol = info_dict.get('protocol')
18
19     if url.startswith('rtmp'):
20         return RtmpFD
21     if (protocol == 'm3u8') or (protocol is None and determine_ext(url) == 'm3u8'):
22         return HlsFD
23     if url.startswith('mms') or url.startswith('rtsp'):
24         return MplayerFD
25     else:
26         return HttpFD