diff --git a/leadhunter_scraper.py b/leadhunter_scraper.py index defcccd..f0bf747 100644 --- a/leadhunter_scraper.py +++ b/leadhunter_scraper.py @@ -62,13 +62,13 @@ TARGET_TYPES = ["restaurant", "cafe", "bar", "bakery", "food"] # Overpass API endpoint OVERPASS_URL = "https://overpass-api.de/api/interpreter" -# Requête Overpass MEL — boundary nommée "Métropole Européenne de Lille" +# Requête Overpass MEL — bounding box directe (50.4,2.8,50.8,3.3) couvrant la MEL +# Fix HRT-72 : la résolution area["name"=...] échoue silencieusement sur l'API Overpass publique OVERPASS_MEL_QUERY = """ [out:json][timeout:60]; -area["name"="Métropole Européenne de Lille"]["boundary"="administrative"]->.mel; ( - node["amenity"~"^(restaurant|cafe|bar|fast_food|bakery)$"]["website"!~".+"](area.mel); - way["amenity"~"^(restaurant|cafe|bar|fast_food|bakery)$"]["website"!~".+"](area.mel); + node["amenity"~"^(restaurant|cafe|bar|fast_food|bakery)$"][!"website"](50.4,2.8,50.8,3.3); + way["amenity"~"^(restaurant|cafe|bar|fast_food|bakery)$"][!"website"](50.4,2.8,50.8,3.3); ); out center 200; """ @@ -279,6 +279,10 @@ class OverpassScraper: resp = requests.post( OVERPASS_URL, data={"data": OVERPASS_MEL_QUERY}, + headers={ + "Content-Type": "application/x-www-form-urlencoded", # Fix HRT-72 Bug2 + "User-Agent": "H3R7Tech-LeadHunter/1.0 (contact@h3r7tech.fr)", # Fix HRT-72 Bug3: overpass-api.de blocks python-requests UA + }, timeout=90, ) resp.raise_for_status()