]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/extractor/testurl.py
[cleanup] Misc
[yt-dlp.git] / yt_dlp / extractor / testurl.py
index 32cae429ee9110624d3234a50f72e7eba6ca1d3c..dccca100467315302e8e1a4cf4d0696696419fdf 100644 (file)
@@ -8,18 +8,20 @@ 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>[0-9]+))?$'
 
     def _real_extract(self, url):
-        from ..extractor import gen_extractor_classes
+        from . import gen_extractor_classes
 
         extractor_id, num = self._match_valid_url(url).group('extractor', 'num')
+        if not extractor_id:
+            return {'id': ':test', 'title': '', 'url': url}
 
         rex = re.compile(extractor_id, flags=re.IGNORECASE)
         matching_extractors = [e for e in gen_extractor_classes() if rex.search(e.IE_NAME)]
 
         if len(matching_extractors) == 0:
-            raise ExtractorError('No extractors matching {extractor_id!r} found', expected=True)
+            raise ExtractorError(f'No extractors matching {extractor_id!r} found', expected=True)
         elif len(matching_extractors) > 1:
             try:  # Check for exact match
                 extractor = next(