"""hqfap.com — latest-vids browse scraper (PlayTube CMS, patrz _playtube.py).

Dołączony 2026-06-10 (user request). Re-uploader katalogu pornhd.pet (~120k scen,
thumbnaile to base64-encoded oryginalne URL-e w `/uploads/images/`).

Specyfika vs baza: studio siedzi w kategoriach z suffixem " Clips"
("Filthy Kings Clips" → studio "Filthy Kings"); reszta kategorii → tagi.
Playback: direct mp4 z JSON-LD contentUrl (cdnde.com nowsze / okcdn.ru starsze),
tokeny time-bound i portable cross-IP → natywny extractor `hqfapcom`.
"""
from __future__ import annotations

from app.connectors.direct_scrapers._playtube import BasePlayTubeScraper


class HQFapScraper(BasePlayTubeScraper):
    sitetag = "hqfapcom"
    base_url = "https://hqfap.com"

    def _pick_studio(self, category_names: list[str]) -> str | None:
        for name in category_names:
            if name.lower().endswith(" clips"):
                studio_name = name[: -len(" clips")].strip()
                if studio_name:
                    return studio_name
        return None
