Some checks are pending
Backend tests / test (push) Waiting to run
Bug-report 986d3018 ('O co chodzi z tym Lady Vi? To wcale nie jest aktorka z tych
filmow'). Search-scrapery filtruja wyniki po tokenach nazwy >=3 znaki, wiec czlon
2-znakowy wypada: 'Lady Vi' -> {lady}, i degeneruje sie do 'slug zawiera
lady' = KAZDA scena z tym slowem. Dla nazw gdzie WSZYSTKIE czlony sa krotkie
('Jj Jj', 'Mi Su') zbior tokenow jest PUSTY, a
przepuszcza wtedy absolutnie wszystko.
Audyt: Lady Vi miala 116 przypisan z tube, z czego 115 pasowalo tylko przez 'lady'
a realnie o niej byla 1. Wyczyszczone (zostaly kanoniczne stashdb + 1 trafione).
Fix: gdy nazwa ma czlon <3 znaki, wymagamy dodatkowo CALEJ nazwy sklejonej bez
separatorow ('lady-vi-...' -> 'ladyvi'). Zweryfikowane: lady-vi-hot-scene przyjmie,
lady-sonia-milf i busty-lady-next-door odrzuci.
94 lines
3.2 KiB
Python
94 lines
3.2 KiB
Python
"""HDPorn92Scraper — direct HTML scrape hdporn92.com search.
|
|
|
|
Search: `https://hdporn92.com/page/<n>/?s=<query>`. Scene URL format:
|
|
`https://hdporn92.com/<slug>/` (jeden segment ścieżki). Trzeba odsiać
|
|
nawigację (`/categories/`, `/actors/`, `/feed/`, `/dmca/`, `/contact-us/`,
|
|
external links badoinkvr/etc.).
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
import logging
|
|
import re
|
|
import urllib.parse
|
|
from collections.abc import Iterator
|
|
|
|
from app.connectors.base import RawPerformer, RawPlaybackSource, RawScene
|
|
from app.connectors.direct_scrapers.base import BaseDirectTubeScraper
|
|
from app.extractors import browser_get
|
|
|
|
log = logging.getLogger(__name__)
|
|
|
|
|
|
_SCENE_URL_RE = re.compile(r'href="(https://hdporn92\.com/([a-z0-9][a-z0-9-]+))/?"')
|
|
|
|
_NAV_SLUGS = {
|
|
"actors", "categories", "tags", "feed", "dmca", "contact-us",
|
|
"comments", "wp-content", "wp-admin", "wp-includes", "wp-login.php",
|
|
"page", "?filter", "?s",
|
|
}
|
|
|
|
|
|
class HDPorn92Scraper(BaseDirectTubeScraper):
|
|
sitetag = "hdporn92com"
|
|
|
|
def search(
|
|
self,
|
|
query: str,
|
|
*,
|
|
page: int = 1,
|
|
limit: int | None = None,
|
|
) -> Iterator[RawScene]:
|
|
q = urllib.parse.quote_plus(query.strip())
|
|
url = f"https://hdporn92.com/page/{page}/?s={q}"
|
|
try:
|
|
r = browser_get(url, timeout=60)
|
|
except Exception as e:
|
|
log.warning("hdporn92 search fetch failed: %s", e)
|
|
return
|
|
if r.status_code != 200:
|
|
return
|
|
|
|
query_tokens = {tok for tok in query.lower().split() if len(tok) >= 3}
|
|
# Człon <3 znaki ("Lady Vi", "Mia Li") wypada z tokenów → zostaje sam pospolity
|
|
# człon i filtr łapie każdą scenę z tym słowem (audit 2026-07-28, over-attribution
|
|
# Lady Vi). Wtedy wymagamy CAŁEJ nazwy sklejonej bez separatorów.
|
|
_compact = re.sub(r"[^a-z0-9]", "", query.lower())
|
|
_needs_compact = any(len(tok) < 3 for tok in query.lower().split()) and len(_compact) >= 4
|
|
|
|
seen: set[str] = set()
|
|
yielded = 0
|
|
for m in _SCENE_URL_RE.finditer(r.text):
|
|
scene_url = m.group(1) + "/"
|
|
slug = m.group(2)
|
|
if slug in _NAV_SLUGS:
|
|
continue
|
|
if scene_url in seen:
|
|
continue
|
|
seen.add(scene_url)
|
|
|
|
slug_lower = slug.lower()
|
|
if query_tokens and not any(tok in slug_lower for tok in query_tokens):
|
|
continue
|
|
if _needs_compact and _compact not in re.sub(r"[^a-z0-9]", "", slug_lower):
|
|
continue
|
|
|
|
title = slug.replace("-", " ").strip()
|
|
|
|
yield RawScene(
|
|
external_id=f"hdporn92com:{scene_url}",
|
|
title=title,
|
|
url=scene_url,
|
|
playback_sources=[
|
|
RawPlaybackSource(origin="tube:hdporn92com", page_url=scene_url)
|
|
],
|
|
performers=[RawPerformer(name=query.strip())],
|
|
raw={
|
|
"source": "direct_scraper:hdporn92",
|
|
"query": query,
|
|
"page": page,
|
|
"url": scene_url,
|
|
},
|
|
)
|
|
yielded += 1
|
|
if limit is not None and yielded >= limit:
|
|
return
|