1
0
mirror of https://github.com/l1ving/youtube-dl synced 2025-02-05 00:52:53 +08:00

Add option to only display suitable detectors when passing a URL.

This commit is contained in:
Romain Beauxis 2014-07-15 15:08:30 -05:00
parent bd1f325b42
commit e656215455

View File

@ -249,6 +249,9 @@ def parseOpts(overrideArguments=None):
general.add_option('--list-extractors',
action='store_true', dest='list_extractors',
help='List all supported extractors and the URLs they would handle', default=False)
general.add_option('--only-suitable',
action='store_true', dest='only_suitable',
help='Only list suitable extractors', default=False)
general.add_option('--extractor-descriptions',
action='store_true', dest='list_extractor_descriptions',
help='Output descriptions of all supported extractors', default=False)
@ -620,10 +623,13 @@ def _real_main(argv=None):
if opts.list_extractors:
for ie in sorted(extractors, key=lambda ie: ie.IE_NAME.lower()):
compat_print(ie.IE_NAME + (' (CURRENTLY BROKEN)' if not ie._WORKING else ''))
matchedUrls = [url for url in all_urls if ie.suitable(url)]
for mu in matchedUrls:
compat_print(u' ' + mu)
if opts.only_suitable and not matchedUrls:
continue
compat_print(ie.IE_NAME + (' (CURRENTLY BROKEN)' if not ie._WORKING else ''))
if not opts.only_suitable:
for mu in matchedUrls:
compat_print(u' ' + mu)
sys.exit(0)
if opts.list_extractor_descriptions:
for ie in sorted(extractors, key=lambda ie: ie.IE_NAME.lower()):