Repository Public
1# =============================================================================2# SP BOUCHER | SOFTWARE & RESEARCH3# ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING4# =============================================================================5#6# PROJECT METADATA7# -----------------------------------------------------------------------------8# Project : Lou·Ka9# File : louka/connectors/gestimmo_estrie.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/gestimmo_estrie.py : connecteur Gestimmo Estrie (gestimmoestrie.com)91# Gestionnaire multi-immeubles de Sherbrooke et de l'Estrie. Même plateforme92# WordPress + thème Houzez que Gestion Dynamic : tout le parsing (cartes,93# pagination /a-louer/page/N/, fiches détail, cache BD) est hérité de94# DynamicConnector. Particularités du site :95# - la disponibilité est l'étiquette de statut de la carte96# (lien /status/ : « Libre maintenant », « Juillet », « Loué »…) ;97# - les fiches n'ont pas d'aperçu Houzez : le type d'unité vient du titre98# (« 4 1/2 Rue de la Sainte-Famille ») ou de la ligne « Grandeur : 4 1/2 »99# de la description.100# Les logements « Loué » sont exclus (filtre hérité).101# -----------------------------------------------------------------------------102from __future__ import annotations103104import re105106from .dynamic import DynamicConnector107108# « Grandeur : 4 1/2 » / « Grandeur: Studio » dans la description des fiches109_SIZE_IN_DESC = re.compile(r"grandeur\s*:?\s*(\d\s*1/2|\d\s*½|studio|loft)", re.I)110111112class GestimmoEstrieConnector(DynamicConnector):113 source_id = "gestimmo_estrie"114115 BASE = "https://gestimmoestrie.com"116 LIST_PATH = "/a-louer/"117 CITY_DEFAULT = "Sherbrooke"118119 # -- crochets par site --------------------------------------------------------120 def _card_availability(self, card, title: str) -> str:121 """Gestimmo : étiquette de statut de la carte (« Libre maintenant »,122 « Juillet », « Loué »…)."""123 status_el = card.select_one("a[href*='/status/']")124 return status_el.get_text(" ", strip=True) if status_el else ""125126 def _fetch_detail(self, url: str) -> dict:127 """Fiche Houzez sans bloc aperçu : repli type d'unité sur la ligne128 « Grandeur : … » de la description."""129 out = super()._fetch_detail(url)130 if not out.get("type_raw") and out.get("description"):131 m = _SIZE_IN_DESC.search(out["description"])132 if m:133 out["type_raw"] = m.group(1)134 return out135