Repository Public
1# =============================================================================2# SP BOUCHER | SOFTWARE & RESEARCH3# ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING4# =============================================================================5#6# PROJECT METADATA7# -----------------------------------------------------------------------------8# Project : Lou·Ka9# File : louka/connectors/immeubles_bois.py10# Module : louka11# Repository : https://git.spboucher.ai/lou-ka12# Created : 2026-08-0913# Last Modified : 2026-08-0914#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/immeubles_bois.py : connecteur Les Immeubles Bois (immeublesbois.ca91# — Rimouski, Bas-Saint-Laurent ; 320+ logements, 26 immeubles, 1½–5½).92# WordPress + Elementor rendu serveur : la page /residentiel/ liste un93# loop-item par immeuble (adresse en h6 + photo aérienne + lien fiche).94# Les fiches d'immeuble ne publient RIEN de plus (titre + « Demander une95# visite » + vignettes d'AUTRES immeubles) : elles ne sont pas visitées —96# 1 seule requête par sync. Granularité IMMEUBLE assumée (précédent girs /97# immeubles_guillot) : aucun prix, aucune unité, aucune disponibilité98# publiés -> price=None, availability vide, rien d'inventé. Tout le parc99# affiché est à Rimouski (coordonnées du siège : 40 rue Saint-Germain Est).100# external_id stable : slug de la fiche (/157-159-rue-hudon/).101# robots.txt : Allow / pour les agents génériques (blocage ciblé de bots102# d'entraînement IA ; Content-Signal search=yes, use=reference — usage103# agrégateur/référence avec lien retour cohérent, précédent place_florimay).104# -----------------------------------------------------------------------------105from __future__ import annotations106107import re108109from bs4 import BeautifulSoup110111from ..schema import Listing112from .base import BaseConnector113114BASE = "https://immeublesbois.ca"115LIST_URL = f"{BASE}/residentiel/"116117118class ImmeublesBoisConnector(BaseConnector):119 source_id = "immeubles_bois"120 request_delay = 0.6121122 def fetch(self) -> list[Listing]:123 soup = BeautifulSoup(self.get(LIST_URL).text, "html.parser")124125 listings: dict[str, Listing] = {}126 for item in soup.select(127 '[data-elementor-type="loop-item"].category-residentiel'):128 try:129 self._parse_item(item, listings)130 except Exception:131 continue132 return list(listings.values())133134 # -- loop-item Elementor (un immeuble) ----------------------------------------135 def _parse_item(self, item, listings: dict[str, Listing]) -> None:136 link = item.select_one("h6 a[href]")137 if link is None:138 return139 url = link["href"].strip()140 title = re.sub(r"\s+", " ", link.get_text(" ", strip=True))141 m = re.search(r"immeublesbois\.ca/([^/?#]+)", url)142 if not m or not title:143 return144 ext_id = m.group(1)145 if ext_id in listings:146 return147148 images: list[str] = []149 img = item.select_one("img[src]")150 if img and img["src"].startswith("http") \151 and "logo" not in img["src"].lower():152 images.append(img["src"])153154 listings[ext_id] = Listing(155 source=self.source_id,156 external_id=ext_id,157 url=url,158 title=title,159 address=f"{title}, Rimouski",160 city="Rimouski", # tout le parc affiché est à Rimouski161 unit_type="", # typologies non publiées par immeuble162 price=None, # aucun loyer publié sur le site163 price_label="",164 availability="", # disponibilités hors ligne (téléphone)165 images=images,166 )167