Repository Public
1# =============================================================================2# SP BOUCHER | SOFTWARE & RESEARCH3# ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING4# =============================================================================5#6# PROJECT METADATA7# -----------------------------------------------------------------------------8# Project : Lou·Ka9# File : louka/connectors/le_730.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/le_730.py : connecteur Le 730 Notre-Dame (730.ca — 186 condos91# locatifs luxueux, marina et club privé au 730, rue Notre-Dame à92# Repentigny, au bord du Saint-Laurent). WordPress/Elementor une-page93# rendu SERVEUR : l'accueil publie les prix « à partir de » par typologie94# (3½/4½), l'occupation (« Occupation immédiate » pour les phases I-II)95# et un plan PDF par variante d'unité (« 3 1/2 – Unité 1 »).96# Granularité TYPOLOGIE (external_id = « le730-N.5 », stable) ; aucune97# liste d'unités individuelles publiée. Les phases III-IV (livraison98# 2027) ne créent pas d'annonce.99# -----------------------------------------------------------------------------100from __future__ import annotations101102import re103104from bs4 import BeautifulSoup105106from ..schema import Listing, normalize_unit_type107from .base import BaseConnector108109PAGE_URL = "https://730.ca/"110ADDRESS = "730, rue Notre-Dame"111CITY = "Repentigny"112113# « 3 ½ à partir de 1750$ »114PRICE_RE = re.compile(r"(\d)\s*½\s*à partir de\s*([\d\s ]+)\s*\$", re.I)115# liens de plans PDF « 3 1/2 – Unité 5 »116PLAN_RE = re.compile(117 r'<a href="(https://730\.ca/wp-content/uploads/[^"]+\.pdf)"[^>]*>'118 r'\s*(\d)\s*<sup>1/2</sup>\s*–\s*Unité\s*(\d+)', re.I)119OCCUP_RE = re.compile(r"Occupation immédiate[^!.]*[!.]?")120IMG_RE = re.compile(r"https://730\.ca/wp-content/uploads/"121 r"[^\"\s\\]+?\.(?:jpe?g|png|webp)", re.I)122IMG_SIZE_RE = re.compile(r"-\d+x\d+(?=\.(?:jpe?g|png|webp))", re.I)123124BUILDING_AMENITIES = ["Toit terrasse", "Jardin communautaire", "BBQ",125 "Piscine", "Gym", "Bornes pour voitures électriques",126 "Club nautique et marina", "Ascenseurs"]127128129class Le730Connector(BaseConnector):130 source_id = "le_730"131 request_delay = 0.8132133 def fetch(self) -> list[Listing]:134 try:135 html = self.get(PAGE_URL).text136 except Exception:137 return []138 soup = BeautifulSoup(html, "html.parser")139 text = re.sub(r"\s+", " ", soup.get_text(" ", strip=True))140141 # prix « à partir de » par typologie142 prices: dict[str, float] = {}143 for m in PRICE_RE.finditer(text):144 try:145 prices.setdefault(f"{m.group(1)}½", float(146 re.sub(r"[\s ]", "", m.group(2))))147 except ValueError:148 pass149150 # plans PDF par variante -> typologies réellement offertes151 plans: dict[str, list[str]] = {}152 for m in PLAN_RE.finditer(html):153 lst = plans.setdefault(f"{m.group(2)}½", [])154 if m.group(1) not in lst: # sections desktop/mobile dupliquées155 lst.append(m.group(1))156 if not plans and not prices:157 return []158159 m = OCCUP_RE.search(text)160 occupation = m.group(0).strip() if m else ""161162 images = []163 for u in dict.fromkeys(IMG_RE.findall(html)):164 u = IMG_SIZE_RE.sub("", u)165 if not re.search(r"logo|icon|favicon|Img_Plans", u, re.I) \166 and u not in images:167 images.append(u)168169 desc_base = ("Le 730 Notre-Dame : plus de 180 condos locatifs, une "170 "marina et un club privé sur les berges du Saint-Laurent "171 "à Repentigny. Projet écoresponsable avec vue sur le "172 "fleuve.")173 listings: list[Listing] = []174 for typo in sorted(set(plans) | set(prices)):175 unit_type = normalize_unit_type(typo)176 price = prices.get(typo)177 nb_plans = len(plans.get(typo, []))178 details: dict = {}179 if plans.get(typo):180 details["floor_plans"] = plans[typo][:12]181 listings.append(Listing(182 source=self.source_id,183 external_id=f"le730-{typo.replace('½', '.5')}",184 url=PAGE_URL,185 title=f"Condo {typo} — Le 730 Notre-Dame",186 address=ADDRESS,187 city=CITY,188 unit_type=unit_type,189 price=price,190 price_label=f"à partir de {price:.0f} $ /mois" if price else "",191 availability=occupation,192 description=(desc_base193 + (f" {nb_plans} plans d'unité {typo} offerts."194 if nb_plans else ""))[:1200],195 amenities=BUILDING_AMENITIES,196 details=details,197 images=images[:20],198 ))199 return listings200