[ka2] fix connecteur rp_ag_greybruce: fallback en code des chemins d'archive (page 1 sans cartes → essai listings/listing/all-regional-listings avec seuil anti-widget-vedette et bascule de self.archive) + ré-application de archive=listings au registre (fix du 2026-08-31 validé found=7575 mais rollback avant la fin du sync de 50 min) — test réel 7573 fiches
4 changed files +27 −9
modified
data/canada_agencies.json
+4 −3
@@ -35,8 +35,9 @@ | |||||
| 35 | "id": "rp_ag_greybruce", | 35 | "id": "rp_ag_greybruce", | ||
| 36 | "name": "Grey Bruce Real Estate", | 36 | "name": "Grey Bruce Real Estate", | ||
| 37 | "site": "https://greybrucerealestate.ca", | 37 | "site": "https://greybrucerealestate.ca", | ||
| 38 | − "note": "Recensement ON 2026-08-27 : ~8 268 fiches (Grey-Bruce/Georgian Bay). RealtyPress/DDF. Même feed que collaborativerealestate.ca (fallback).", | 38 | + "note": "Recensement ON 2026-08-27 : ~8 268 fiches (Grey-Bruce/Georgian Bay). RealtyPress/DDF. Même feed que collaborativerealestate.ca (fallback). 2026-08-31 : refonte du site, /listing/ → 404 (avec widget 12 cartes vedettes), archive déplacée sur /listings/ — sync validé found=7575 le 2026-08-31 ; le connecteur a aussi un fallback en code qui détecte le chemin d'archive déplacé.", | ||
| 39 | − "province": "Ontario" | 39 | + "province": "Ontario", | ||
| 40 | + "archive": "listings" | ||||
| 40 | }, | 41 | }, | ||
| 41 | { | 42 | { | ||
| 42 | "id": "rp_ag_remaxfinest", | 43 | "id": "rp_ag_remaxfinest", | ||
@@ -144,4 +145,4 @@ | |||||
| 144 | "province": "Alberta", | 145 | "province": "Alberta", | ||
| 145 | "note": "Recensement CANADA 2026-08-27 : ~≥60 fiches, provinces page 1 : {'Alberta': 25}. RealtyPress/DDF." | 146 | "note": "Recensement CANADA 2026-08-27 : ~≥60 fiches, provinces page 1 : {'Alberta': 25}. RealtyPress/DDF." | ||
| 146 | } | 147 | } | ||
| 147 | −] | ||||
| \ No newline at end of file | |||||
| 148 | +] | ||||
modified
data/sources.json
+1 −1
@@ -48,7 +48,7 @@ | |||||
| 48 | "id": "rp_ag_greybruce", | 48 | "id": "rp_ag_greybruce", | ||
| 49 | "name": "Grey Bruce Real Estate", | 49 | "name": "Grey Bruce Real Estate", | ||
| 50 | "url": "https://greybrucerealestate.ca", | 50 | "url": "https://greybrucerealestate.ca", | ||
| 51 | − "listing_url": "https://greybrucerealestate.ca/listing/", | 51 | + "listing_url": "https://greybrucerealestate.ca/listings/", | ||
| 52 | "coverage": "Grey-Bruce / Georgian Bay (ITSO) — ~8 300 fiches DDF", | 52 | "coverage": "Grey-Bruce / Georgian Bay (ITSO) — ~8 300 fiches DDF", | ||
| 53 | "connector": "realtypress", | 53 | "connector": "realtypress", | ||
| 54 | "status": "actif", | 54 | "status": "actif", | ||
modified
immoka/connectors/realtypress.py
+21 −4
@@ -126,16 +126,33 @@ class _RealtyPress(BaseConnector): | |||||
| 126 | # gabarit sans cartes) : réessayer, puis variantes d'URL — un | 126 | # gabarit sans cartes) : réessayer, puis variantes d'URL — un | ||
| 127 | # échec ici ferait retirer TOUTES les fiches de la source | 127 | # échec ici ferait retirer TOUTES les fiches de la source | ||
| 128 | import time as _t | 128 | import time as _t | ||
| 129 | − for alt in (url, f"{base}/{self.archive}/?posts_per_page=100", | 129 | + alts = [(self.archive, url), | ||
| 130 | − f"{base}/{self.archive}/page/2/{pp}"): | 130 | + (self.archive, f"{base}/{self.archive}/?posts_per_page=100"), | ||
| 131 | + (self.archive, f"{base}/{self.archive}/page/2/{pp}")] | ||||
| 132 | + # refonte de site : l'archive change parfois de chemin SANS | ||||
| 133 | + # redirection (greybruce 2026-08 : /listing/ → 404 avec widget | ||||
| 134 | + # « 12 vedettes », archive réelle déplacée sur /listings/) — | ||||
| 135 | + # essayer les autres chemins connus du parc RealtyPress et | ||||
| 136 | + # basculer self.archive pour les pages suivantes. Seuil de | ||||
| 137 | + # cartes pour ne pas confondre un widget vedette (~12 cartes) | ||||
| 138 | + # avec une vraie page d'archive (100/page, 10 en natif). | ||||
| 139 | + min_cards = 20 if self.use_pp else 5 | ||||
| 140 | + alts += [(a, f"{base}/{a}/{pp}") | ||||
| 141 | + for a in ("listings", "listing", "all-regional-listings") | ||||
| 142 | + if a != self.archive] | ||||
| 143 | + orig_archive, accepted = self.archive, False | ||||
| 144 | + for arch, alt in alts: | ||||
| 131 | _t.sleep(2.0) | 145 | _t.sleep(2.0) | ||
| 132 | try: | 146 | try: | ||
| 133 | body = self.get(alt).text | 147 | body = self.get(alt).text | ||
| 134 | except Exception: | 148 | except Exception: | ||
| 135 | continue | 149 | continue | ||
| 136 | − if _CARD_RE.search(body): | 150 | + n = len(_CARD_RE.findall(body)) | ||
| 151 | + if n and (arch == orig_archive or n >= min_cards): | ||||
| 152 | + self.archive = arch | ||||
| 153 | + accepted = True | ||||
| 137 | break | 154 | break | ||
| 138 | − if not _CARD_RE.search(body): | 155 | + if not accepted: | ||
| 139 | raise RuntimeError( | 156 | raise RuntimeError( | ||
| 140 | f"{self.source_id}: archive sans cartes après reprises " | 157 | f"{self.source_id}: archive sans cartes après reprises " | ||
| 141 | "(page vide intermittente ?) — sync abandonné pour " | 158 | "(page vide intermittente ?) — sync abandonné pour " | ||
modified
sources.json
+1 −1
@@ -48,7 +48,7 @@ | |||||
| 48 | "id": "rp_ag_greybruce", | 48 | "id": "rp_ag_greybruce", | ||
| 49 | "name": "Grey Bruce Real Estate", | 49 | "name": "Grey Bruce Real Estate", | ||
| 50 | "url": "https://greybrucerealestate.ca", | 50 | "url": "https://greybrucerealestate.ca", | ||
| 51 | − "listing_url": "https://greybrucerealestate.ca/listing/", | 51 | + "listing_url": "https://greybrucerealestate.ca/listings/", | ||
| 52 | "coverage": "Grey-Bruce / Georgian Bay (ITSO) — ~8 300 fiches DDF", | 52 | "coverage": "Grey-Bruce / Georgian Bay (ITSO) — ~8 300 fiches DDF", | ||
| 53 | "connector": "realtypress", | 53 | "connector": "realtypress", | ||
| 54 | "status": "actif", | 54 | "status": "actif", | ||
| 55 | 55 | ||||