]>
Commit | Line | Data |
---|---|---|
9f435c5f PH |
1 | from .common import InfoExtractor |
2 | from ..utils import ExtractorError | |
3 | ||
4 | ||
5 | class CommonMistakesIE(InfoExtractor): | |
6 | IE_DESC = False # Do not list | |
0647d925 | 7 | _VALID_URL = r'(?:url|URL|yt-dlp)$' |
9f435c5f PH |
8 | |
9 | _TESTS = [{ | |
10 | 'url': 'url', | |
11 | 'only_matching': True, | |
12 | }, { | |
13 | 'url': 'URL', | |
14 | 'only_matching': True, | |
15 | }] | |
16 | ||
17 | def _real_extract(self, url): | |
18 | msg = ( | |
add96eb9 | 19 | f'You\'ve asked yt-dlp to download the URL "{url}". ' |
9f435c5f PH |
20 | 'That doesn\'t make any sense. ' |
21 | 'Simply remove the parameter in your command or configuration.' | |
add96eb9 | 22 | ) |
a06916d9 | 23 | if not self.get_param('verbose'): |
0760b0a7 | 24 | msg += ' Add -v to the command line to see what arguments and configuration yt-dlp has' |
9f435c5f | 25 | raise ExtractorError(msg, expected=True) |
c73fae1e PH |
26 | |
27 | ||
28 | class UnicodeBOMIE(InfoExtractor): | |
cd37ef44 S |
29 | IE_DESC = False |
30 | _VALID_URL = r'(?P<bom>\ufeff)(?P<id>.*)$' | |
31 | ||
cfb0511d | 32 | _TESTS = [{ |
cd37ef44 S |
33 | 'url': '\ufeffhttp://www.youtube.com/watch?v=BaW_jenozKc', |
34 | 'only_matching': True, | |
35 | }] | |
36 | ||
37 | def _real_extract(self, url): | |
38 | real_url = self._match_id(url) | |
39 | self.report_warning( | |
40 | 'Your URL starts with a Byte Order Mark (BOM). ' | |
add96eb9 | 41 | f'Removing the BOM and looking for "{real_url}" ...') |
cd37ef44 | 42 | return self.url_result(real_url) |
98d71d8c | 43 | |
44 | ||
45 | class BlobIE(InfoExtractor): | |
46 | IE_DESC = False | |
47 | _VALID_URL = r'blob:' | |
48 | ||
49 | _TESTS = [{ | |
50 | 'url': 'blob:https://www.youtube.com/4eb3d090-a761-46e6-8083-c32016a36e3b', | |
51 | 'only_matching': True, | |
52 | }] | |
53 | ||
54 | def _real_extract(self, url): | |
55 | raise ExtractorError( | |
56 | 'You\'ve asked yt-dlp to download a blob URL. ' | |
57 | 'A blob URL exists only locally in your browser. ' | |
58 | 'It is not possible for yt-dlp to access it.', expected=True) |