logo

youtube-dl

[mirror] Download/Watch videos from video hostersgit clone https://hacktivis.me/git/mirror/youtube-dl.git

__init__.py (1258B)


  1. from __future__ import unicode_literals
  2. try:
  3. from .lazy_extractors import *
  4. from .lazy_extractors import _ALL_CLASSES
  5. _LAZY_LOADER = True
  6. except ImportError:
  7. _LAZY_LOADER = False
  8. from .extractors import *
  9. _ALL_CLASSES = [
  10. klass
  11. for name, klass in globals().items()
  12. if name.endswith('IE') and name != 'GenericIE'
  13. ]
  14. _ALL_CLASSES.append(GenericIE)
  15. def gen_extractor_classes():
  16. """ Return a list of supported extractors.
  17. The order does matter; the first extractor matched is the one handling the URL.
  18. """
  19. return _ALL_CLASSES
  20. def gen_extractors():
  21. """ Return a list of an instance of every supported extractor.
  22. The order does matter; the first extractor matched is the one handling the URL.
  23. """
  24. return [klass() for klass in gen_extractor_classes()]
  25. def list_extractors(age_limit):
  26. """
  27. Return a list of extractors that are suitable for the given age,
  28. sorted by extractor ID.
  29. """
  30. return sorted(
  31. filter(lambda ie: ie.is_suitable(age_limit), gen_extractors()),
  32. key=lambda ie: ie.IE_NAME.lower())
  33. def get_info_extractor(ie_name):
  34. """Returns the info extractor class with the given ie_name"""
  35. return globals()[ie_name + 'IE']