Pin Booking.com search to a dest_id
Free-text ss= destination resolution is non-deterministic: tonight's 30-day run resolved "Stow on the Wold" to St. Wolfgang, Austria for 8 of 30 dates, saving Salzkammergut hotel rates into the matrix. dest_id + dest_type=city in the search URL pins the destination. - booking_scrape_config gains a dest_id column (idempotent ALTER) - scrape_location_search/_build_search_url thread dest_id through - /config/location accepts dest_id Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
270d8293d1
commit
9e5728efb1
5 changed files with 34 additions and 12 deletions
|
|
@ -30,6 +30,7 @@ class LocationConfigRequest(BaseModel):
|
|||
location_name: str
|
||||
pages_to_scrape: int = 2
|
||||
adults: int = 2
|
||||
dest_id: Optional[str] = None # Booking.com numeric destination id (pins the search)
|
||||
|
||||
|
||||
class HotelTierUpdate(BaseModel):
|
||||
|
|
@ -310,10 +311,11 @@ async def set_location_config(
|
|||
# Insert new config
|
||||
await db.execute(
|
||||
text("""
|
||||
INSERT INTO booking_scrape_config (location_name, pages_to_scrape, adults, is_active)
|
||||
VALUES (:location, :pages, :adults, TRUE)
|
||||
INSERT INTO booking_scrape_config (location_name, pages_to_scrape, adults, dest_id, is_active)
|
||||
VALUES (:location, :pages, :adults, :dest_id, TRUE)
|
||||
"""),
|
||||
{'location': config.location_name, 'pages': config.pages_to_scrape, 'adults': config.adults}
|
||||
{'location': config.location_name, 'pages': config.pages_to_scrape,
|
||||
'adults': config.adults, 'dest_id': config.dest_id}
|
||||
)
|
||||
await db.commit()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue