Repository Public
1# =============================================================================2# SP BOUCHER | SOFTWARE & RESEARCH3# ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING4# =============================================================================5#6# PROJECT METADATA7# -----------------------------------------------------------------------------8# Project : Lou·Ka9# File : louka/connectors/inovario.py10# Module : louka11# Repository : https://git.spboucher.ai/lou-ka12# Created : 2026-08-2513# Last Modified : 2026-08-2514#15# =============================================================================16# AUTHOR & PROFESSIONAL AFFILIATION17# =============================================================================18#19# Author : Simon-Pierre Boucher20# Position : Professor of Finance21# Institution : Université du Québec en Outaouais (UQO)22# Department : Département des sciences administratives23# Organization : SP Boucher24#25# Website : https://spboucher.ai26# Git : https://git.spboucher.ai27#28# =============================================================================29# OFFICIAL CONTACT DIRECTORY30# =============================================================================31#32# General : info@spboucher.ai33# Professional : contact@spboucher.ai34# Direct : simon@spboucher.ai35# Research : research@spboucher.ai36# Development : dev@spboucher.ai37# Support : support@spboucher.ai38# Security/Admin : admin@spboucher.ai39# Notifications : notifications@spboucher.ai40#41# Preferred Contact: contact@spboucher.ai42#43# =============================================================================44# COPYRIGHT & INTELLECTUAL PROPERTY45# =============================================================================46#47# Copyright (c) 202648# Simon-Pierre Boucher49#50# All rights reserved where applicable.51#52# This file is governed by the applicable project license,53# copyright notices, institutional agreements and relevant law.54#55# Unless expressly authorized by the applicable license or56# rights holder, copying, redistribution, sublicensing,57# publication and commercial exploitation are not permitted.58#59# Existing third-party rights and notices remain unaffected.60#61# =============================================================================62# CONFIDENTIALITY & SECURITY63# =============================================================================64#65# Classification : Public66# Distribution : Public repository; use is governed by the project license67# Security Contact : admin@spboucher.ai68#69# Access to this source does not independently grant permission70# to redistribute or disclose confidential materials.71#72# Do not embed credentials, private keys, access tokens,73# certificates or confidential personal information.74#75# =============================================================================76# LICENSE & MAINTENANCE77# =============================================================================78#79# License : None specified (no license file in this repository)80# Maintainer : Simon-Pierre Boucher81# Technical Contact: dev@spboucher.ai82#83# =============================================================================84# END OF SP BOUCHER SOURCE HEADER85# =============================================================================8687# -----------------------------------------------------------------------------88# Lou-Ka — Agrégateur de logements à louer (province de Québec)89# Auteur : Simon-Pierre Boucher — contact@spboucher.ai90# connectors/inovario.py : connecteur Inovario (inovario.com)91# Promoteur-gestionnaire de Châteauguay — deux projets locatifs : rue92# St-Denis et Quartier du Centre Signature. WordPress/Elementor rendu93# serveur : le sitemap Yoast (/sitemap_index.xml → page-sitemap.xml) liste94# une page par modèle d'appartement (chateauguay-<projet>-<type>[-modele-…]).95# Pas de prix ni d'unités individuelles publiés. Granularité : modèle96# (typologie).97# -----------------------------------------------------------------------------98from __future__ import annotations99100import re101102from bs4 import BeautifulSoup103104from .base import BaseConnector105from ..schema import Listing, normalize_unit_type106107BASE = "https://inovario.com"108SITEMAP = f"{BASE}/page-sitemap.xml"109110CITY = "Châteauguay"111112LOC_RE = re.compile(r"<loc>([^<]+)</loc>")113MODEL_RE = re.compile(r"^https://inovario\.com/(chateauguay-[a-z0-9-]+)/?$")114TYPE_RE = re.compile(r"(\d)-(?:1-2|et-demi)")115SQFT_RE = re.compile(r"(\d{3,4})-pc")116IMG_RE = re.compile(r'https://inovario\.com/wp-content/uploads/'117 r'[^"\s\\)]+\.(?:jpe?g|png|webp)', re.I)118119120class InovarioConnector(BaseConnector):121 source_id = "inovario"122 request_delay = 0.6123124 def fetch(self) -> list[Listing]:125 listings: list[Listing] = []126 try:127 xml = self.get(SITEMAP).text128 except Exception:129 return listings130131 for url in LOC_RE.findall(xml):132 m = MODEL_RE.match(url.strip())133 if not m:134 continue135 slug = m.group(1)136 mt = TYPE_RE.search(slug)137 if not mt:138 continue # pages de projet/hub, pas des modèles139 unit_type = normalize_unit_type(f"{mt.group(1)}½")140141 if "st-denis" in slug:142 project = "Rue St-Denis"143 address = "rue Saint-Denis, Châteauguay"144 else:145 project = "Quartier du Centre Signature"146 address = "rue Principale, Châteauguay"147148 sqft = None149 ms = SQFT_RE.search(slug)150 if ms:151 sqft = float(ms.group(1))152153 title, amenities, images = "", [], []154 try:155 html = self.get(url).text156 soup = BeautifulSoup(html, "html.parser")157 h1 = soup.find("h1")158 if h1:159 title = h1.get_text(" ", strip=True)160 # « CARACTÉRISTIQUES DE NOS APPARTEMENTS » : liste à puces161 for li in soup.select("ul li"):162 t = li.get_text(" ", strip=True)163 if 3 < len(t) < 90 and not li.find("a"):164 amenities.append(t)165 images = [u for u in dict.fromkeys(IMG_RE.findall(html))166 if not re.search(r"logo|icon|favicon", u, re.I)][:15]167 except Exception:168 pass169170 variant = ""171 mv = re.search(r"(modele-[\w-]+|coin|centre|den)$", slug)172 if mv:173 variant = mv.group(1).replace("modele-", "modèle ")174175 listings.append(Listing(176 source=self.source_id,177 external_id=slug,178 url=url,179 title=title or f"{unit_type} — {project}, Châteauguay",180 address=address,181 city=CITY,182 unit_type=unit_type,183 area_sqft=sqft,184 availability="",185 details={"project": project,186 **({"variant": variant} if variant else {})},187 description=f"Appartement {unit_type} de style condo du "188 f"projet {project} à Châteauguay : planchers de "189 f"béton insonorisés, aires ouvertes et grande "190 f"fenestration. Prix sur demande.",191 amenities=list(dict.fromkeys(amenities))[:15],192 images=images,193 ))194 return listings195