]> jfr.im git - yt-dlp.git/blame - yt_dlp/extractor/commonmistakes.py
[cleanup] Remove unused code paths (#2173)
[yt-dlp.git] / yt_dlp / extractor / commonmistakes.py
CommitLineData
9f435c5f
PH
1from __future__ import unicode_literals
2
3from .common import InfoExtractor
4from ..utils import ExtractorError
5
6
7class CommonMistakesIE(InfoExtractor):
8 IE_DESC = False # Do not list
9 _VALID_URL = r'''(?x)
e01bfc19 10 (?:url|URL)$
9f435c5f
PH
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 = (
7a5c1cfe 23 'You\'ve asked yt-dlp to download the URL "%s". '
9f435c5f
PH
24 'That doesn\'t make any sense. '
25 'Simply remove the parameter in your command or configuration.'
26 ) % url
a06916d9 27 if not self.get_param('verbose'):
0760b0a7 28 msg += ' Add -v to the command line to see what arguments and configuration yt-dlp has'
9f435c5f 29 raise ExtractorError(msg, expected=True)
c73fae1e
PH
30
31
32class UnicodeBOMIE(InfoExtractor):
cd37ef44
S
33 IE_DESC = False
34 _VALID_URL = r'(?P<bom>\ufeff)(?P<id>.*)$'
35
cfb0511d 36 _TESTS = [{
cd37ef44
S
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)