extend the output of '--list-extractors'
It now includes category and subcategory values for each extractor class.
This commit is contained in:
@@ -117,13 +117,12 @@ Description Amount of time (in seconds) to wait for a successful connection
|
||||
Extractor Options
|
||||
=================
|
||||
|
||||
| Each extractor is identified by its ``category`` and ``subcategory``.
|
||||
| The ``category`` is the lowercase site name without any spaces or special
|
||||
characters, which is usually just the module name
|
||||
(``pixiv``, ``batoto``, ...).
|
||||
The ``subcategory`` is a lowercase word describing the general functionality
|
||||
of that extractor (``user``, ``favorite``, ``manga``, ...).
|
||||
|
||||
Each extractor is identified by its ``category`` and ``subcategory``.
|
||||
The ``category`` is the lowercase site name without any spaces or special
|
||||
characters, which is usually just the module name
|
||||
(``pixiv``, ``batoto``, ...).
|
||||
The ``subcategory`` is a lowercase word describing the general functionality
|
||||
of that extractor (``user``, ``favorite``, ``manga``, ...).
|
||||
|
||||
Each one of the following options can be specified on multiple levels of the
|
||||
configuration tree:
|
||||
@@ -140,16 +139,11 @@ you specify a general filename pattern for all the different pixiv extractors.
|
||||
Using the ``extractor.pixiv.user.filename`` value lets you override this
|
||||
general pattern specifically for ``PixivUserExtractor`` instances.
|
||||
|
||||
The ``category`` and ``subcategory`` of an extractor used for a specific URL
|
||||
can be determined by using the ``--list-keywords`` command-line option
|
||||
The ``category`` and ``subcategory`` of all extractors are included in the
|
||||
output of ``gallery-dl --list-extractors``. For a specific URL these values
|
||||
can also be determined by using the ``--list-keywords`` command-line option
|
||||
(see the example below).
|
||||
|
||||
If that does not work, the extractor names, which can be obtained from
|
||||
``gallery-dl --list-extractors``, provide an alternative:
|
||||
Each extractor name is structured as ``CategorySubcategoryExtractor``.
|
||||
An extractor called ``PixivUserExtractor`` has therefore the category ``pixiv``
|
||||
and the subcategory ``user``.
|
||||
|
||||
extractor.*.filename
|
||||
--------------------
|
||||
=========== =====
|
||||
|
||||
@@ -80,11 +80,14 @@ def main():
|
||||
print(module_name)
|
||||
elif args.list_extractors:
|
||||
for extr in extractor.extractors():
|
||||
if not extr.__doc__:
|
||||
continue
|
||||
print(extr.__name__)
|
||||
if extr.__doc__:
|
||||
print(extr.__doc__)
|
||||
print(extr.__doc__)
|
||||
print("Category:", extr.category,
|
||||
"- Subcategory:", extr.subcategory)
|
||||
if hasattr(extr, "test") and extr.test:
|
||||
print("Example:", extr.test[0][0])
|
||||
print("Example :", extr.test[0][0])
|
||||
print()
|
||||
else:
|
||||
if not args.urls and not args.inputfile:
|
||||
|
||||
@@ -152,7 +152,7 @@ def build_parser():
|
||||
parser.add_argument(
|
||||
"--list-extractors", dest="list_extractors", action="store_true",
|
||||
help=("Print a list of extractor classes "
|
||||
"with description and example URL"),
|
||||
"with description, (sub)category and example URL"),
|
||||
)
|
||||
parser.add_argument(
|
||||
"--list-keywords", dest="list_keywords", action="store_true",
|
||||
|
||||
Reference in New Issue
Block a user