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

Search: `https://xhamster.com/search/<q>?page=<n>`
Scene URL: `https://xhamster.com/videos/<slug>-<id>`
"""
from __future__ import annotations

import re

from app.connectors.direct_scrapers._search_base import BaseSearchScraper


class XHamsterScraper(BaseSearchScraper):
    sitetag = "xhamstercom"
    _search_url_template = "https://xhamster.com/search/{query}?page={page}"
    _scene_url_re = re.compile(
        r'href="(?P<url>https://xhamster\.com/videos/(?P<slug>[a-z0-9_\-]+))"',
        re.IGNORECASE,
    )
