diff options
author | Philipp Hagemeister <phihag@phihag.de> | 2013-07-01 18:52:19 +0200 |
---|---|---|
committer | Philipp Hagemeister <phihag@phihag.de> | 2013-07-01 18:52:19 +0200 |
commit | 0f818663291752b2084d81aff76d945a43c66a06 (patch) | |
tree | b70d0df45ab1f751e79f924733e8a582fd7e2420 /youtube_dl/__init__.py | |
parent | 2db67bc0f40d8a2938145a6630901360834cf387 (diff) |
Add --list-extractor-descriptions (human-readable list of IEs)
Diffstat (limited to 'youtube_dl/__init__.py')
-rw-r--r-- | youtube_dl/__init__.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/youtube_dl/__init__.py b/youtube_dl/__init__.py index c4b09695c..4f1829214 100644 --- a/youtube_dl/__init__.py +++ b/youtube_dl/__init__.py @@ -35,6 +35,7 @@ import codecs import getpass import optparse import os +import random import re import shlex import socket @@ -142,6 +143,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('--list-extractor-descriptions', + action='store_true', dest='list_extractor_descriptions', + help='Output descriptions of all supported extractors', default=False) general.add_option('--proxy', dest='proxy', default=None, help='Use the specified HTTP/HTTPS proxy', metavar='URL') general.add_option('--no-check-certificate', action='store_true', dest='no_check_certificate', default=False, help='Suppress HTTPS certificate validation.') @@ -427,6 +431,18 @@ def _real_main(argv=None): 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()): + if not ie._WORKING: + continue + desc = getattr(ie, 'IE_DESC', ie.IE_NAME) + if hasattr(ie, 'SEARCH_KEY'): + _SEARCHES = (u'cute kittens', u'slithering pythons', u'falling cat', u'angry poodle', u'purple fish', u'running tortoise') + _COUNTS = (u'', u'5', u'10', u'all') + desc += u' (Example: "%s%s:%s" )' % (ie.SEARCH_KEY, random.choice(_COUNTS), random.choice(_SEARCHES)) + compat_print(desc) + sys.exit(0) + # Conflicting, missing and erroneous options if opts.usenetrc and (opts.username is not None or opts.password is not None): |