2021-05-05 23:45:10 +02:00
|
|
|
from configparser import SectionProxy
|
|
|
|
from typing import Callable, Dict
|
|
|
|
|
2021-05-13 18:57:20 +02:00
|
|
|
from ..authenticator import Authenticator
|
2021-05-10 23:50:16 +02:00
|
|
|
from ..conductor import TerminalConductor
|
2021-05-05 23:45:10 +02:00
|
|
|
from ..config import Config
|
2021-05-10 23:50:16 +02:00
|
|
|
from ..crawler import Crawler
|
2021-05-15 15:18:51 +02:00
|
|
|
from .ilias import IliasCrawler, IliasCrawlerSection
|
2021-05-06 01:02:40 +02:00
|
|
|
from .local import LocalCrawler, LocalCrawlerSection
|
2021-04-29 13:44:29 +02:00
|
|
|
|
2021-05-10 23:50:16 +02:00
|
|
|
CrawlerConstructor = Callable[[
|
2021-05-13 18:57:20 +02:00
|
|
|
str, # Name (without the "crawl:" prefix)
|
|
|
|
SectionProxy, # Crawler's section of global config
|
|
|
|
Config, # Global config
|
|
|
|
TerminalConductor, # Global conductor instance
|
|
|
|
Dict[str, Authenticator], # Loaded authenticators by name
|
2021-05-10 23:50:16 +02:00
|
|
|
], Crawler]
|
|
|
|
|
|
|
|
CRAWLERS: Dict[str, CrawlerConstructor] = {
|
2021-05-13 18:57:20 +02:00
|
|
|
"local": lambda n, s, c, t, a:
|
2021-05-10 23:50:16 +02:00
|
|
|
LocalCrawler(n, LocalCrawlerSection(s), c, t),
|
2021-05-15 15:18:51 +02:00
|
|
|
"ilias": lambda n, s, c, t, a:
|
|
|
|
IliasCrawler(n, IliasCrawlerSection(s), c, t, a),
|
2021-04-29 13:44:29 +02:00
|
|
|
}
|