aboutsummaryrefslogtreecommitdiffstats
path: root/hypervideo_dl/extractor/testurl.py
diff options
context:
space:
mode:
Diffstat (limited to 'hypervideo_dl/extractor/testurl.py')
-rw-r--r--hypervideo_dl/extractor/testurl.py19
1 files changed, 12 insertions, 7 deletions
diff --git a/hypervideo_dl/extractor/testurl.py b/hypervideo_dl/extractor/testurl.py
index dccca10..3cf0017 100644
--- a/hypervideo_dl/extractor/testurl.py
+++ b/hypervideo_dl/extractor/testurl.py
@@ -8,7 +8,7 @@ class TestURLIE(InfoExtractor):
""" Allows addressing of the test cases as test:yout.*be_1 """
IE_DESC = False # Do not list
- _VALID_URL = r'test(?:url)?:(?P<extractor>.*?)(?:_(?P<num>[0-9]+))?$'
+ _VALID_URL = r'test(?:url)?:(?P<extractor>.*?)(?:_(?P<num>\d+|all))?$'
def _real_extract(self, url):
from . import gen_extractor_classes
@@ -23,11 +23,12 @@ class TestURLIE(InfoExtractor):
if len(matching_extractors) == 0:
raise ExtractorError(f'No extractors matching {extractor_id!r} found', expected=True)
elif len(matching_extractors) > 1:
- try: # Check for exact match
- extractor = next(
- ie for ie in matching_extractors
- if ie.IE_NAME.lower() == extractor_id.lower())
- except StopIteration:
+ extractor = next(( # Check for exact match
+ ie for ie in matching_extractors if ie.IE_NAME.lower() == extractor_id.lower()
+ ), None) or next(( # Check for exact match without plugin suffix
+ ie for ie in matching_extractors if ie.IE_NAME.split('+')[0].lower() == extractor_id.lower()
+ ), None)
+ if not extractor:
raise ExtractorError(
'Found multiple matching extractors: %s' % ' '.join(ie.IE_NAME for ie in matching_extractors),
expected=True)
@@ -35,6 +36,10 @@ class TestURLIE(InfoExtractor):
extractor = matching_extractors[0]
testcases = tuple(extractor.get_testcases(True))
+ if num == 'all':
+ return self.playlist_result(
+ [self.url_result(tc['url'], extractor) for tc in testcases],
+ url, f'{extractor.IE_NAME} tests')
try:
tc = testcases[int(num or 0)]
except IndexError:
@@ -42,4 +47,4 @@ class TestURLIE(InfoExtractor):
f'Test case {num or 0} not found, got only {len(testcases)} tests', expected=True)
self.to_screen(f'Test URL: {tc["url"]}')
- return self.url_result(tc['url'])
+ return self.url_result(tc['url'], extractor)