Move FileDownloader to its own module and create a new class for each download process
[youtube-dl] / youtube_dl / downloader / __init__.py
1 from .common import FileDownloader
2 from .hls import HlsFD
3 from .http import HttpFD
4 from .mplayer import MplayerFD
5 from .rtmp import RtmpFD
6
7 from ..utils import (
8     determine_ext,
9 )
10
11 def get_suitable_downloader(info_dict):
12     """Get the downloader class that can handle the info dict."""
13     url = info_dict['url']
14
15     if url.startswith('rtmp'):
16         return RtmpFD
17     if determine_ext(url) == u'm3u8':
18         return HlsFD
19     if url.startswith('mms') or url.startswith('rtsp'):
20         return MplayerFD
21     else:
22         return HttpFD
23