extend the output of '--list-extractors'

It now includes category and subcategory values for
each extractor class.
This commit is contained in:
Mike Fährmann
2017-06-28 18:51:47 +02:00
parent 1dac76fd1c
commit 06c4cae05b
3 changed files with 16 additions and 19 deletions

View File

@@ -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:

View File

@@ -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",