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