]>
Commit | Line | Data |
---|---|---|
db1f3888 PH |
1 | from __future__ import unicode_literals |
2 | ||
3bc2ddcc JMF |
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 | |
cf1eb451 | 8 | from .f4m import F4mFD |
3bc2ddcc JMF |
9 | |
10 | from ..utils import ( | |
11 | determine_ext, | |
12 | ) | |
13 | ||
f89197d7 | 14 | |
3bc2ddcc JMF |
15 | def get_suitable_downloader(info_dict): |
16 | """Get the downloader class that can handle the info dict.""" | |
17 | url = info_dict['url'] | |
db1f3888 | 18 | protocol = info_dict.get('protocol') |
3bc2ddcc JMF |
19 | |
20 | if url.startswith('rtmp'): | |
21 | return RtmpFD | |
db1f3888 | 22 | if (protocol == 'm3u8') or (protocol is None and determine_ext(url) == 'm3u8'): |
3bc2ddcc JMF |
23 | return HlsFD |
24 | if url.startswith('mms') or url.startswith('rtsp'): | |
25 | return MplayerFD | |
cf1eb451 JMF |
26 | if determine_ext(url) == 'f4m': |
27 | return F4mFD | |
3bc2ddcc JMF |
28 | else: |
29 | return HttpFD |