]> jfr.im git - yt-dlp.git/blame - youtube_dl/downloader/__init__.py
Fix all PEP8 issues except E501
[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
f0b5d6af 5from .hls import NativeHlsFD
3bc2ddcc
JMF
6from .http import HttpFD
7from .mplayer import MplayerFD
8from .rtmp import RtmpFD
cf1eb451 9from .f4m import F4mFD
3bc2ddcc
JMF
10
11from ..utils import (
12 determine_ext,
13)
14
f89197d7 15
3bc2ddcc
JMF
16def 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