diff options
author | Matthew <coletdjnz@protonmail.com> | 2023-01-02 04:55:11 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-02 04:55:11 +0000 |
commit | e756f45ba0648f972be71ce328419a623e381028 (patch) | |
tree | 39fd427fe2ce2725b0b84bf0c6d719ff090d166d /yt_dlp/extractor/testurl.py | |
parent | 8c53322cda75394a8d551dde20b2529ee5ad6e89 (diff) | |
download | hypervideo-pre-e756f45ba0648f972be71ce328419a623e381028.tar.lz hypervideo-pre-e756f45ba0648f972be71ce328419a623e381028.tar.xz hypervideo-pre-e756f45ba0648f972be71ce328419a623e381028.zip |
Improve handling for overriding extractors with plugins (#5916)
* Extractors replaced with plugin extractors now show in debug output
* Better testcase handling
* Added documentation
Authored by: coletdjnz, pukkandan
Diffstat (limited to 'yt_dlp/extractor/testurl.py')
-rw-r--r-- | yt_dlp/extractor/testurl.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/yt_dlp/extractor/testurl.py b/yt_dlp/extractor/testurl.py index dccca1004..0da01aa53 100644 --- a/yt_dlp/extractor/testurl.py +++ b/yt_dlp/extractor/testurl.py @@ -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) |