2024-01-24 11:27:21 +00:00
|
|
|
from importlib.util import find_spec
|
|
|
|
|
2024-01-24 11:07:04 +00:00
|
|
|
import papis.logging
|
|
|
|
|
2024-01-23 08:21:46 +00:00
|
|
|
from papis_extract.extraction import Extractor
|
|
|
|
from papis_extract.extractors import pdf
|
2024-01-24 07:55:43 +00:00
|
|
|
from papis_extract.extractors.pocketbook import PocketBookExtractor
|
2024-01-23 08:21:46 +00:00
|
|
|
|
2024-01-24 11:07:04 +00:00
|
|
|
logger = papis.logging.get_logger(__name__)
|
|
|
|
|
2024-01-24 11:27:21 +00:00
|
|
|
all_extractors: dict[str, Extractor] = {}
|
2024-01-24 11:07:04 +00:00
|
|
|
|
2024-01-24 11:27:21 +00:00
|
|
|
all_extractors["pdf"] = pdf.PdfExtractor()
|
2024-01-24 11:07:04 +00:00
|
|
|
|
2024-01-24 11:27:21 +00:00
|
|
|
if find_spec("bs4") and find_spec("magic"):
|
2024-01-24 11:07:04 +00:00
|
|
|
all_extractors["pocketbook"] = PocketBookExtractor()
|
2024-01-24 11:27:21 +00:00
|
|
|
else:
|
2024-01-24 11:07:04 +00:00
|
|
|
logger.debug("pocketbook extractor not activated.")
|