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 — tests de détection de pièges2# Author: Simon-Pierre Boucher3# Contact: contact@spboucher.ai45from trouveka.crawler.traps import looks_like_trap678def test_session_ids():9 assert looks_like_trap("https://x.ca/p?PHPSESSID=abc123")10 assert looks_like_trap("https://x.ca/p?sid=9f8e7d")111213def test_too_many_params():14 url = "https://x.ca/p?" + "&".join(f"f{i}={i}" for i in range(12))15 assert looks_like_trap(url)161718def test_repeated_facet_param():19 assert looks_like_trap("https://x.ca/s?f=a&f=b&f=c&f=d&f=e")202122def test_deep_paths_and_loops():23 assert looks_like_trap("https://x.ca/" + "/".join(["seg"] * 15))24 assert looks_like_trap("https://x.ca/a/b/a/b/a/b/a/b")252627def test_far_future_calendar():28 assert looks_like_trap("https://x.ca/events/2085/05/17")29 assert not looks_like_trap("https://x.ca/nouvelles/2024/06/12")303132def test_excessive_pagination():33 assert looks_like_trap("https://x.ca/liste?page=9999")34 assert not looks_like_trap("https://x.ca/liste?page=3")353637def test_normal_urls_pass():38 assert not looks_like_trap("https://www.quebec.ca/services/permis?type=conduire")39 assert not looks_like_trap("https://ici.radio-canada.ca/nouvelle/2024/ceci-est-un-titre")40