]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/downloader/__init__.py
Prepare for upload.
[youtubedl] / youtube_dl / downloader / __init__.py
1 from __future__ import unicode_literals
2
3 from .common import FileDownloader
4 from .hls import HlsFD
5 from .hls import NativeHlsFD
6 from .http import HttpFD
7 from .mplayer import MplayerFD
8 from .rtmp import RtmpFD
9 from .f4m import F4mFD
10
11 from ..utils import (
12 determine_ext,
13 )
14
15
16 def get_suitable_downloader(info_dict):
17 """Get the downloader class that can handle the info dict."""
18 url = info_dict['url']
19 protocol = info_dict.get('protocol')
20
21 if url.startswith('rtmp'):
22 return RtmpFD
23 if protocol == 'm3u8_native':
24 return NativeHlsFD
25 if (protocol == 'm3u8') or (protocol is None and determine_ext(url) == 'm3u8'):
26 return HlsFD
27 if url.startswith('mms') or url.startswith('rtsp'):
28 return MplayerFD
29 if determine_ext(url) == 'f4m':
30 return F4mFD
31 else:
32 return HttpFD
33
34 __all__ = [
35 'get_suitable_downloader',
36 'FileDownloader',
37 ]