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.

46 lines
1.4 KiB

  1. from __future__ import unicode_literals
  2. from .common import InfoExtractor
  3. from ..utils import ExtractorError
  4. class CommonMistakesIE(InfoExtractor):
  5. IE_DESC = False # Do not list
  6. _VALID_URL = r'''(?x)
  7. (?:url|URL)
  8. '''
  9. _TESTS = [{
  10. 'url': 'url',
  11. 'only_matching': True,
  12. }, {
  13. 'url': 'URL',
  14. 'only_matching': True,
  15. }]
  16. def _real_extract(self, url):
  17. msg = (
  18. 'You\'ve asked youtube-dl to download the URL "%s". '
  19. 'That doesn\'t make any sense. '
  20. 'Simply remove the parameter in your command or configuration.'
  21. ) % url
  22. if not self._downloader.params.get('verbose'):
  23. msg += ' Add -v to the command line to see what arguments and configuration youtube-dl got.'
  24. raise ExtractorError(msg, expected=True)
  25. class UnicodeBOMIE(InfoExtractor):
  26. IE_DESC = False
  27. _VALID_URL = r'(?P<bom>\ufeff)(?P<id>.*)$'
  28. _TESTS = [{
  29. 'url': '\ufeffhttp://www.youtube.com/watch?v=BaW_jenozKc',
  30. 'only_matching': True,
  31. }]
  32. def _real_extract(self, url):
  33. real_url = self._match_id(url)
  34. self.report_warning(
  35. 'Your URL starts with a Byte Order Mark (BOM). '
  36. 'Removing the BOM and looking for "%s" ...' % real_url)
  37. return self.url_result(real_url)