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

Sxyprn search jest oparte na `?type=videos&query=<q>` GET endpoint który zwraca
HTML strony z linkami. Scene URL format: `https://sxyprn.com/post/<post_id>.html`.

Page'owanie sxyprn niespójne — często single-page results dla query (~24 wyników).
"""
from __future__ import annotations

import re

from app.connectors.direct_scrapers._search_base import BaseSearchScraper


class SxyPrnScraper(BaseSearchScraper):
    sitetag = "sxyprncom"
    _search_url_template = "https://sxyprn.com/?type=videos&query={query}&page={page}"
    _scene_url_re = re.compile(
        r'href="(?P<url>/post/(?P<slug>[a-z0-9]+))\.html"',
    )

    def _title_from_slug(self, slug: str) -> str:
        # sxyprn post ID to nieczytelny hash — placeholder, title backfill przy resolve.
        return f"sxyprn:{slug}"
