From f2e11bf585784b9edceea620007eb4a321836938 Mon Sep 17 00:00:00 2001 From: jtricerolph Date: Thu, 9 Jul 2026 23:20:15 +0000 Subject: [PATCH] Use qty dropdown for availability count, not just scarcity text MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The 'We have X left' scarcity indicator only appears when availability is low (typically ≤5). The quantity in the last table cell per rate plan row, falling back to regex parsing of the cell text if the select isn't rendered, then to the scarcity text as a last resort. Stored in both rooms_left and available_qty on RateData. Co-Authored-By: Claude Sonnet 4.6 --- .../scraper_backends/playwright_hotel_page.py | 31 +++++++++++++++++-- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/backend/services/scraper_backends/playwright_hotel_page.py b/backend/services/scraper_backends/playwright_hotel_page.py index 0c9d8ea..64276a4 100644 --- a/backend/services/scraper_backends/playwright_hotel_page.py +++ b/backend/services/scraper_backends/playwright_hotel_page.py @@ -73,15 +73,39 @@ _EXTRACT_RATES_JS = """ const cancelMatch = condCell.match(/free cancellation before ([\\w\\s]+)/i); const freeCancelText = cancelMatch ? cancelMatch[1].trim() : null; - // Persons: first ("Max persons: 2" or "Only for 1 guest") + // Persons: first ("Max persons: 2" or "Only for 1 guest") const personsCell = cells.length >= 1 ? cells[0].innerText || '' : ''; const personsMatch = personsCell.match(/\\d+/); const maxPersons = personsMatch ? parseInt(personsMatch[0]) : null; + // Quantity dropdown: last has a