]>
Commit | Line | Data |
---|---|---|
9f435c5f PH |
1 | from __future__ import unicode_literals |
2 | ||
2cc7fcd3 S |
3 | import sys |
4 | ||
9f435c5f PH |
5 | from .common import InfoExtractor |
6 | from ..utils import ExtractorError | |
7 | ||
8 | ||
9 | class CommonMistakesIE(InfoExtractor): | |
10 | IE_DESC = False # Do not list | |
11 | _VALID_URL = r'''(?x) | |
e01bfc19 | 12 | (?:url|URL)$ |
9f435c5f PH |
13 | ''' |
14 | ||
15 | _TESTS = [{ | |
16 | 'url': 'url', | |
17 | 'only_matching': True, | |
18 | }, { | |
19 | 'url': 'URL', | |
20 | 'only_matching': True, | |
21 | }] | |
22 | ||
23 | def _real_extract(self, url): | |
24 | msg = ( | |
25 | 'You\'ve asked youtube-dl to download the URL "%s". ' | |
26 | 'That doesn\'t make any sense. ' | |
27 | 'Simply remove the parameter in your command or configuration.' | |
28 | ) % url | |
753fad4a | 29 | if not self._downloader.params.get('verbose'): |
9f435c5f PH |
30 | msg += ' Add -v to the command line to see what arguments and configuration youtube-dl got.' |
31 | raise ExtractorError(msg, expected=True) | |
c73fae1e PH |
32 | |
33 | ||
34 | class UnicodeBOMIE(InfoExtractor): | |
35 | IE_DESC = False | |
36 | _VALID_URL = r'(?P<bom>\ufeff)(?P<id>.*)$' | |
37 | ||
2cc7fcd3 | 38 | # Disable test for python 3.2 since BOM is broken in re in this version |
067aa17e | 39 | # (see https://github.com/ytdl-org/youtube-dl/issues/9751) |
2cc7fcd3 | 40 | _TESTS = [] if (3, 0) < sys.version_info <= (3, 3) else [{ |
c73fae1e PH |
41 | 'url': '\ufeffhttp://www.youtube.com/watch?v=BaW_jenozKc', |
42 | 'only_matching': True, | |
43 | }] | |
44 | ||
45 | def _real_extract(self, url): | |
46 | real_url = self._match_id(url) | |
47 | self.report_warning( | |
48 | 'Your URL starts with a Byte Order Mark (BOM). ' | |
49 | 'Removing the BOM and looking for "%s" ...' % real_url) | |
50 | return self.url_result(real_url) |