SPB Git

Repository Public

alexcellence.py 5.7 KB 134 lines python

1# =============================================================================2#                  SP BOUCHER | SOFTWARE & RESEARCH3#             ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING4# =============================================================================5#6# PROJECT METADATA7# -----------------------------------------------------------------------------8# Project          : Lou·Ka9# File             : louka/connectors/alexcellence.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/alexcellence.py : connecteur Immeubles Alexcellence91#   (immeublesalexcellence.com) — apparts à Sherbrooke, secteurs Université de92#   Sherbrooke et Mont-Bellevue (clientèle étudiante). WordPress + thème93#   immobilier Houzez : 4e membre de la famille Houzez de l'Estrie — hérite de94#   DynamicConnector (lesgestionsdynamic.com) et n'en redéfinit que les95#   constantes et le crochet de disponibilité. Archive /appartements-a-louer/96#   paginée (cartes item-listing-wrap v6 avec data-listid, data-images,97#   item-price « 1,010$/par mois »). Particularité locale : les étiquettes98#   label-status portent à la fois le statut (« À LOUER » / « LOUÉ ») et la99#   date de libération (« 1er août 2026 ») — les logements LOUÉ sont écartés,100#   la date devient la disponibilité. Fiches détail Houzez sans bloc adresse101#   structuré ni GPS : description + address.item-address seulement.102# -----------------------------------------------------------------------------103from __future__ import annotations104105import re106107from .dynamic import DynamicConnector108109110class AlexcellenceConnector(DynamicConnector):111    source_id = "alexcellence"112    request_delay = 0.7113    max_pages = 6114    max_details = 40115116    BASE = "https://immeublesalexcellence.com"117    LIST_PATH = "/appartements-a-louer/"118    CITY_DEFAULT = "Sherbrooke"119120    def _card_availability(self, card, title: str) -> str:121        """Étiquettes label-status de la carte : « LOUÉ » fait écarter le122        logement (le parent filtre toute disponibilité contenant « loué ») ;123        sinon l'étiquette de date (« 1er août 2026 ») est la disponibilité."""124        labels = [re.sub(r"\s+", " ", el.get_text(" ", strip=True)).strip()125                  for el in card.select(".label-status")]126        labels = [l for l in labels if l]127        for label in labels:128            if re.search(r"\blou[ée]s?\b", label, re.I):129                return label            # « LOUÉ » -> carte écartée130        for label in labels:131            if not re.fullmatch(r"[àa] louer", label, re.I):132                return label            # date de libération133        return ""134
Files main
Menu

Theme