From d50d1c07f66c120b557dc45eddbc2b354545f442 Mon Sep 17 00:00:00 2001 From: Viktor Barzin Date: Sun, 22 Feb 2026 00:54:58 +0000 Subject: [PATCH] Use high-res images and return all photos in GeoJSON MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Use maxSizeUrl instead of url for photo URLs (highest available resolution from Rightmove) - Remove 5-photo cap in GeoJSON export — return all available photos - Apply same fix to both streaming and model-based export paths, and to the listing detail API endpoint --- api/app.py | 4 ++-- ui_exporter.py | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/api/app.py b/api/app.py index c8d9c63..7ea0389 100644 --- a/api/app.py +++ b/api/app.py @@ -604,14 +604,14 @@ async def get_listing_detail( text_info = property_info.get("text", {}) description = text_info.get("description") if isinstance(text_info, dict) else None - # Extract photos + # Extract photos (prefer high-res maxSizeUrl) photos_raw = property_info.get("images", []) photos: list[dict] = [] if isinstance(photos_raw, list): for img in photos_raw: if isinstance(img, dict): photos.append({ - "url": img.get("url", ""), + "url": img.get("maxSizeUrl") or img.get("url", ""), "caption": img.get("caption", ""), "type": img.get("type", ""), }) diff --git a/ui_exporter.py b/ui_exporter.py index 4a8b914..cb7709c 100644 --- a/ui_exporter.py +++ b/ui_exporter.py @@ -53,14 +53,18 @@ def convert_row_to_geojson(row: dict[str, Any], listing_type: str = "RENT") -> d else: last_seen_str = str(last_seen_val) - # Extract first 5 photo URLs from additional_info + # Extract photo URLs from additional_info (prefer high-res maxSizeUrl) photos: list[str] = [] additional_info = row.get('additional_info') if additional_info: if isinstance(additional_info, str): additional_info = json.loads(additional_info) images = additional_info.get('property', {}).get('images', []) - photos = [img['url'] for img in images[:5] if isinstance(img, dict) and 'url' in img] + photos = [ + img.get('maxSizeUrl') or img['url'] + for img in images + if isinstance(img, dict) and ('maxSizeUrl' in img or 'url' in img) + ] if not photos and row.get('photo_thumbnail'): photos = [row['photo_thumbnail']] @@ -110,9 +114,13 @@ def convert_to_geojson_feature(listing: RentListing | BuyListing) -> dict[str, A property_info = listing.additional_info.get("property", {}) if listing.additional_info else {} listing_type = "RENT" if isinstance(listing, RentListing) else "BUY" - # Extract first 5 photo URLs + # Extract photo URLs (prefer high-res maxSizeUrl) images = property_info.get('images', []) - photos = [img['url'] for img in images[:5] if isinstance(img, dict) and 'url' in img] + photos = [ + img.get('maxSizeUrl') or img['url'] + for img in images + if isinstance(img, dict) and ('maxSizeUrl' in img or 'url' in img) + ] if not photos and listing.photo_thumbnail: photos = [listing.photo_thumbnail]