dev: include plot text in Serienstream genre list entries

This commit is contained in:
2026-02-24 13:54:33 +01:00
parent 358cfb1967
commit f1f9d8f5d8
2 changed files with 38 additions and 4 deletions

View File

@@ -1427,6 +1427,42 @@ class SerienstreamPlugin(BasisPlugin):
art.setdefault("poster", cover)
self._series_metadata_cache[key] = (info, art)
@staticmethod
def _card_description(anchor: BeautifulSoupT) -> str:
if not anchor:
return ""
candidates: List[str] = []
direct = (anchor.get("data-search") or "").strip()
if direct:
candidates.append(direct)
title_attr = (anchor.get("data-title") or "").strip()
if title_attr:
candidates.append(title_attr)
for selector in ("p", ".description", ".desc", ".text-muted", ".small", ".overview"):
node = anchor.select_one(selector)
if node is None:
continue
text = (node.get_text(" ", strip=True) or "").strip()
if text:
candidates.append(text)
parent = anchor.parent if anchor else None
if parent is not None:
parent_data = (parent.get("data-search") or "").strip()
if parent_data:
candidates.append(parent_data)
parent_text = ""
try:
parent_text = (parent.get_text(" ", strip=True) or "").strip()
except Exception:
parent_text = ""
if parent_text and len(parent_text) > 24:
candidates.append(parent_text)
for value in candidates:
cleaned = re.sub(r"\s+", " ", str(value or "")).strip()
if cleaned and len(cleaned) > 12:
return cleaned
return ""
def _parse_genre_entries_from_soup(self, soup: BeautifulSoupT) -> List[SeriesResult]:
entries: List[SeriesResult] = []
seen_urls: set[str] = set()
@@ -1459,10 +1495,7 @@ class SerienstreamPlugin(BasisPlugin):
or (anchor.get("title") or "")
or (anchor.get_text(" ", strip=True) or "")
).strip()
description = (anchor.get("data-search") or "").strip()
parent = anchor.parent if anchor else None
if parent is not None and not description:
description = (parent.get("data-search") or "").strip()
description = self._card_description(anchor)
cover = (img.get("data-src") if img else "") or (img.get("src") if img else "")
_add_entry(title, description, href, cover)