]> jfr.im git - yt-dlp.git/blame - youtube_dl/downloader/__init__.py
renamed for consistency
[yt-dlp.git] / youtube_dl / downloader / __init__.py
CommitLineData
db1f3888
PH
1from __future__ import unicode_literals
2
3bc2ddcc
JMF
3from .common import FileDownloader
4from .hls import HlsFD
5from .http import HttpFD
6from .mplayer import MplayerFD
7from .rtmp import RtmpFD
cf1eb451 8from .f4m import F4mFD
3bc2ddcc
JMF
9
10from ..utils import (
11 determine_ext,
12)
13
f89197d7 14
3bc2ddcc
JMF
15def 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