"""perverzija.com — direct HTML scrape search results.

Search: `https://www.perverzija.com/page/<n>/?s=<q>` (WordPress + Cloudflare).
Scene URL: `https://www.perverzija.com/<slug>/`.

CF-protected: `browser_get` (curl_cffi) bypassuje JA3 fingerprint blocks.
"""
from __future__ import annotations

import re

from app.connectors.direct_scrapers._search_base import BaseSearchScraper


class PerverzijaScraper(BaseSearchScraper):
    sitetag = "perverzijacom"
    _search_url_template = "https://www.perverzija.com/page/{page}/?s={query}"
    _scene_url_re = re.compile(
        r'href="(?P<url>https://www\.perverzija\.com/(?P<slug>[a-z0-9][a-z0-9\-]+))/"',
        re.IGNORECASE,
    )
