]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/downloader/__init__.py
debian/changelog: Start new release.
[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 .http import HttpFD
6 from .mplayer import MplayerFD
7 from .rtmp import RtmpFD
8 from .f4m import F4mFD
9
10 from ..utils import (
11 determine_ext,
12 )
13
14
15 def get_suitable_downloader(info_dict):
16 """Get the downloader class that can handle the info dict."""
17 url = info_dict['url']
18 protocol = info_dict.get('protocol')
19
20 if url.startswith('rtmp'):
21 return RtmpFD
22 if (protocol == 'm3u8') or (protocol is None and determine_ext(url) == 'm3u8'):
23 return HlsFD
24 if url.startswith('mms') or url.startswith('rtsp'):
25 return MplayerFD
26 if determine_ext(url) == 'f4m':
27 return F4mFD
28 else:
29 return HttpFD