fix(latestpornvideo): miniatury z imgds zamiast martwego ticdn, bez tagu "mixed porn"

Proxy miniatur oddaje 404 dla banera usunietego obrazka pixhost i dla
odpowiedzi tekstowych (link do strony podgladu), zamiast 200 z atrapa.
Kategorie mixed-porn i porn-movie pomijane: serwis daje je kazdemu wpisowi.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
goon-foss 2026-10-15 12:22:54 +02:00
parent d521e6379d
commit 6379e98dd9
2 changed files with 17 additions and 1 deletions

View file

@ -451,6 +451,15 @@ async def proxy_image(
media_type="image/jpeg", media_type="image/jpeg",
) )
ct = r.headers.get("content-type", "image/jpeg") ct = r.headers.get("content-type", "image/jpeg")
# Atrapy zamiast obrazka (zgloszenia eb20f1c0/4d8d5daf, latestpornvideo): pixhost
# przekierowuje usuniete obrazki na baner `/image/removed.png`, a link do strony
# podgladu (`pixhost.to/show/...`) daje HTML. Oba szly do apki jako 200, wiec kafelek
# pokazywal baner albo byl pusty. 404 = apka rysuje swoj zastepnik.
final_url = str(getattr(r, "url", "") or "")
# Tylko text/*: czesc CDN-ow (S3) podaje prawdziwe obrazki jako octet-stream.
if final_url.endswith("/image/removed.png") or ct.lower().startswith("text/"):
log.info("img proxy: atrapa zamiast obrazka (%s, %s) dla %s", ct, final_url[:80], target)
return Response(content=b"", status_code=404, media_type="image/jpeg")
return Response( return Response(
content=r.content, content=r.content,
media_type=ct, media_type=ct,

View file

@ -45,6 +45,7 @@ _BASE = "https://latestpornvideo.com"
_ARTICLE_RE = re.compile(r'<article[^>]*\bclass="([^"]+)"', re.IGNORECASE) _ARTICLE_RE = re.compile(r'<article[^>]*\bclass="([^"]+)"', re.IGNORECASE)
_LINK_RE = re.compile(r'<a\s+href="([^"]+)"\s+title="([^"]+)"', re.IGNORECASE) _LINK_RE = re.compile(r'<a\s+href="([^"]+)"\s+title="([^"]+)"', re.IGNORECASE)
_THUMB_RE = re.compile(r'data-main-thumb="([^"]+)"', re.IGNORECASE) _THUMB_RE = re.compile(r'data-main-thumb="([^"]+)"', re.IGNORECASE)
_TICDN_RE = re.compile(r"^https?://(?:[a-z0-9-]+\.)*ticdn\.net/snaps/", re.IGNORECASE)
_CLASS_TAG_RE = re.compile(r"\btag-([a-z0-9-]+)") _CLASS_TAG_RE = re.compile(r"\btag-([a-z0-9-]+)")
_CLASS_CAT_RE = re.compile(r"\bcategory-([a-z0-9-]+)") _CLASS_CAT_RE = re.compile(r"\bcategory-([a-z0-9-]+)")
# Nazwa thumba: `<Studio>-YYYY-MM-DD-<rest>-cover.jpg`. # Nazwa thumba: `<Studio>-YYYY-MM-DD-<rest>-cover.jpg`.
@ -52,7 +53,9 @@ _THUMB_NAME_RE = re.compile(r"/([A-Za-z0-9][A-Za-z0-9-]*?)-(\d{4})-(\d{2})-(\d{2
# Tytuł: `<Studio> YY MM DD <rest>` (np. "MySexMobile 20 10 23 Abella Danger"). # Tytuł: `<Studio> YY MM DD <rest>` (np. "MySexMobile 20 10 23 Abella Danger").
_TITLE_DATE_RE = re.compile(r"^(.*?)\s*\b(\d{2})\s+(\d{2})\s+(\d{2})\b") _TITLE_DATE_RE = re.compile(r"^(.*?)\s*\b(\d{2})\s+(\d{2})\s+(\d{2})\b")
# Karty homepage zawsze siedzą w kategorii "latest-porn-videos", to nie jest tag. # Karty homepage zawsze siedzą w kategorii "latest-porn-videos", to nie jest tag.
_CAT_SKIP = {"latest-porn-videos", "uncategorized", ""} # "mixed-porn" i "porn-movie": od 09.2026 serwis daje KAZDEMU wpisowi tylko te kategorie,
# wiec nic nie mowia (zgloszenie 3204ee85, 2026-10-12: "tylko mixed porn").
_CAT_SKIP = {"latest-porn-videos", "uncategorized", "", "mixed-porn", "porn-movie"}
def _name_from_slug(slug: str) -> str: def _name_from_slug(slug: str) -> str:
@ -103,6 +106,10 @@ class LatestPornVideoScraper(BaseBrowseScraper):
thumb_m = _THUMB_RE.search(window) thumb_m = _THUMB_RE.search(window)
thumb = thumb_m.group(1) if thumb_m else None thumb = thumb_m.group(1) if thumb_m else None
if thumb:
# ticdn.net (stary serwer miniatur DoodStream) nie istnieje, te same pliki
# leza na imgds.net (2026-10-15, 8 tys. martwych kafelkow).
thumb = _TICDN_RE.sub("https://imgds.net/snaps/", thumb)
# Studio + release_date z nazwy thumba (`<Studio>-YYYY-MM-DD-`). # Studio + release_date z nazwy thumba (`<Studio>-YYYY-MM-DD-`).
studio: RawStudio | None = None studio: RawStudio | None = None