You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
544 B

  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. from ..utils import (
  7. determine_ext,
  8. )
  9. def get_suitable_downloader(info_dict):
  10. """Get the downloader class that can handle the info dict."""
  11. url = info_dict['url']
  12. if url.startswith('rtmp'):
  13. return RtmpFD
  14. if determine_ext(url) == u'm3u8':
  15. return HlsFD
  16. if url.startswith('mms') or url.startswith('rtsp'):
  17. return MplayerFD
  18. else:
  19. return HttpFD