goon/app/connectors/direct_scrapers/xnxx.py
goon-foss ad0284585b Initial commit
Goon — self-hosted aggregator for adult-content scene metadata.

Indexes scenes from TPDB, StashDB, and 30+ public adult tube sites.
Cross-source deduplication via perceptual hash + Levenshtein distance.
FastAPI backend + APScheduler worker + React Native (Expo) mobile client.

FOSS, ad-free, donation-funded. See README for details.
2026-05-20 10:10:22 +02:00

28 lines
957 B
Python

"""XNXX.com — direct HTML scrape search results.
Search: `https://www.xnxx.com/search/<q>/<page-1>` (xnxx 0-indexed)
Scene URL: `https://www.xnxx.com/video-<id>/<slug>`
"""
from __future__ import annotations
import re
from app.connectors.direct_scrapers._search_base import BaseSearchScraper
class XnxxScraper(BaseSearchScraper):
sitetag = "xnxxcom"
# `/<page-1>` — handle override in search() by replacing {page}.
_search_url_template = "https://www.xnxx.com/search/{query}/{page}"
_scene_url_re = re.compile(
r'href="(?P<url>/video-[a-z0-9]+/(?P<slug>[a-z0-9_\-]+))"',
re.IGNORECASE,
)
def search(self, query, *, page=1, limit=None):
original = self._search_url_template
self._search_url_template = original.replace("{page}", str(page - 1))
try:
yield from super().search(query, page=page, limit=limit)
finally:
self._search_url_template = original