Unify menu labels, centralize hoster URL normalization, and add auto-update toggle
This commit is contained in:
@@ -735,44 +735,49 @@ class FilmpalastPlugin(BasisPlugin):
|
||||
def _extract_detail_metadata(self, soup: BeautifulSoupT) -> tuple[str, str]:
|
||||
if not soup:
|
||||
return "", ""
|
||||
root = soup.select_one("div#content[role='main']") or soup
|
||||
detail = root.select_one("article.detail") or root
|
||||
plot = ""
|
||||
poster = ""
|
||||
|
||||
for selector in ("meta[property='og:description']", "meta[name='description']"):
|
||||
node = soup.select_one(selector)
|
||||
if node is None:
|
||||
continue
|
||||
content = (node.get("content") or "").strip()
|
||||
if content:
|
||||
plot = content
|
||||
break
|
||||
# Filmpalast Detailseite: bevorzugt den dedizierten Filmhandlung-Block.
|
||||
plot_node = detail.select_one(
|
||||
"li[itemtype='http://schema.org/Movie'] span[itemprop='description']"
|
||||
)
|
||||
if plot_node is not None:
|
||||
plot = (plot_node.get_text(" ", strip=True) or "").strip()
|
||||
if not plot:
|
||||
for selector in (".toggle-content .coverDetails", ".entry-content p", "article p"):
|
||||
node = soup.select_one(selector)
|
||||
hidden_plot = detail.select_one("cite span.hidden")
|
||||
if hidden_plot is not None:
|
||||
plot = (hidden_plot.get_text(" ", strip=True) or "").strip()
|
||||
if not plot:
|
||||
for selector in ("meta[property='og:description']", "meta[name='description']"):
|
||||
node = root.select_one(selector)
|
||||
if node is None:
|
||||
continue
|
||||
text = (node.get_text(" ", strip=True) or "").strip()
|
||||
if text and len(text) > 40:
|
||||
plot = text
|
||||
content = (node.get("content") or "").strip()
|
||||
if content:
|
||||
plot = content
|
||||
break
|
||||
|
||||
for selector in ("meta[property='og:image']", "meta[name='twitter:image']"):
|
||||
node = soup.select_one(selector)
|
||||
if node is None:
|
||||
continue
|
||||
content = (node.get("content") or "").strip()
|
||||
if content:
|
||||
poster = _absolute_url(content)
|
||||
break
|
||||
# Filmpalast Detailseite: Cover liegt stabil in `img.cover2`.
|
||||
cover = detail.select_one("img.cover2")
|
||||
if cover is not None:
|
||||
value = (cover.get("data-src") or cover.get("src") or "").strip()
|
||||
if value:
|
||||
candidate = _absolute_url(value)
|
||||
lower = candidate.casefold()
|
||||
if "/themes/" not in lower and "spacer.gif" not in lower and "/files/movies/" in lower:
|
||||
poster = candidate
|
||||
if not poster:
|
||||
for selector in ("img.cover", "article img", ".entry-content img"):
|
||||
image = soup.select_one(selector)
|
||||
if image is None:
|
||||
continue
|
||||
value = (image.get("data-src") or image.get("src") or "").strip()
|
||||
thumb_node = detail.select_one("li[itemtype='http://schema.org/Movie'] img[itemprop='image']")
|
||||
if thumb_node is not None:
|
||||
value = (thumb_node.get("data-src") or thumb_node.get("src") or "").strip()
|
||||
if value:
|
||||
poster = _absolute_url(value)
|
||||
break
|
||||
candidate = _absolute_url(value)
|
||||
lower = candidate.casefold()
|
||||
if "/themes/" not in lower and "spacer.gif" not in lower and "/files/movies/" in lower:
|
||||
poster = candidate
|
||||
|
||||
return plot, poster
|
||||
|
||||
|
||||
Reference in New Issue
Block a user