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