mirror of
https://github.com/RicterZ/nhentai.git
synced 2026-04-08 10:40:22 +02:00
History reset as part of DMCA compliance. The project has been refactored into a generic, site-agnostic download framework. Site-specific logic lives in separate plugin packages. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
29 lines
824 B
Python
29 lines
824 B
Python
# coding: utf-8
|
|
from typing import TYPE_CHECKING
|
|
|
|
if TYPE_CHECKING:
|
|
from doujinshi_dl.core.plugin import BasePlugin
|
|
|
|
|
|
def get_plugin(name: str) -> 'BasePlugin':
|
|
from importlib.metadata import entry_points
|
|
eps = entry_points(group='doujinshi_dl.plugins')
|
|
for ep in eps:
|
|
if ep.name == name:
|
|
return ep.load()
|
|
raise KeyError(
|
|
f"Plugin {name!r} not found. "
|
|
f"Install it with: pip install doujinshi-dl-{name}"
|
|
)
|
|
|
|
|
|
def get_first_plugin() -> 'BasePlugin':
|
|
from importlib.metadata import entry_points
|
|
eps = list(entry_points(group='doujinshi_dl.plugins'))
|
|
if not eps:
|
|
raise RuntimeError(
|
|
"No doujinshi-dl plugin installed. "
|
|
"Install a plugin from PyPI, e.g.: pip install doujinshi-dl-<name>"
|
|
)
|
|
return eps[0].load()
|