spb/trouve-ka Public
Trouve-KA — moteur de recherche web indépendant, Québec-first. Crawler distribué, index OpenSearch, ranking bilingue, galerie d'images. En prod : www.trouve-ka.com
Python 76.8%
TypeScript 15.7%
SQL 3.9%
Shell 1.4%
CSS 1.3%
Dockerfile 0.7%
1# Trouve-KA — hachage de contenu et détection de changement2# Author: Simon-Pierre Boucher3# Contact: contact@spboucher.ai45"""Hachage de contenu pour la déduplication exacte et la détection de changement.67Le hash est calculé sur le texte extrait normalisé (pas le HTML brut) pour8ignorer le bruit de balisage (nonces, timestamps de rendu, etc.).9"""1011import hashlib12import re1314_WHITESPACE = re.compile(r"\s+")151617def text_fingerprint(text: str) -> str:18 """Texte normalisé pour hachage : espaces réduits, minuscules."""19 return _WHITESPACE.sub(" ", text).strip().lower()202122def content_hash(title: str, body: str) -> str:23 """SHA-256 du contenu textuel normalisé (titre + corps)."""24 payload = text_fingerprint(title) + "\n" + text_fingerprint(body)25 return hashlib.sha256(payload.encode("utf-8")).hexdigest()26