dev: bump to 0.1.66 and harden resolveurl + serienstream

This commit is contained in:
2026-02-25 16:35:16 +01:00
parent 74d15cb25e
commit 73f07d20b4
20 changed files with 522 additions and 232 deletions

View File

@@ -39,6 +39,8 @@ from plugin_interface import BasisPlugin
from plugin_helpers import dump_response_html, get_setting_bool, get_setting_string, log_error, log_url, notify_url
from http_session_pool import get_requests_session
from regex_patterns import DIGITS, SEASON_EPISODE_TAG, SEASON_EPISODE_URL, STAFFEL_NUM_IN_URL
from search_utils import matches_query as _shared_matches_query, normalize_search_text as _shared_normalize_search_text
from genre_utils import normalize_genre_label as _normalize_genre_label
if TYPE_CHECKING: # pragma: no cover
from requests import Session as RequestsSession
@@ -257,10 +259,7 @@ def _log_error(message: str) -> None:
def _normalize_search_text(value: str) -> str:
value = (value or "").casefold()
value = re.sub(r"[^a-z0-9]+", " ", value)
value = re.sub(r"\s+", " ", value).strip()
return value
return _shared_normalize_search_text(value)
def _strip_html(text: str) -> str:
@@ -270,11 +269,7 @@ def _strip_html(text: str) -> str:
def _matches_query(query: str, *, title: str) -> bool:
normalized_query = _normalize_search_text(query)
if not normalized_query:
return False
haystack = f" {_normalize_search_text(title)} "
return f" {normalized_query} " in haystack
return _shared_matches_query(query, title=title)
def _ensure_requests() -> None:
@@ -357,28 +352,6 @@ def _get_soup_simple(url: str) -> BeautifulSoupT:
return BeautifulSoup(body, "html.parser")
def _normalize_genre_label(raw: str) -> str:
text = unescape(re.sub(r"\s+", " ", str(raw or ""))).strip()
if not text:
return ""
key_prefix = "filter.genre_"
if text.casefold().startswith(key_prefix):
slug = text[len(key_prefix) :].strip().casefold()
slug = slug.replace("_", "-")
slug = re.sub(r"[^a-z0-9-]+", "-", slug).strip("-")
if not slug:
return ""
special = {
"doku-soap": "Doku-Soap",
"scifi": "SciFi",
"fighting-shounen": "Fighting-Shounen",
}
if slug in special:
return special[slug]
return " ".join(chunk.capitalize() for chunk in slug.split("-") if chunk)
return text
def _extract_genre_names_from_html(body: str) -> List[str]:
names: List[str] = []
seen: set[str] = set()