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
|
|
@ -82,7 +82,7 @@ def get_scrape_config(db: Session) -> Optional[Dict[str, Any]]:
|
|||
"""Get the active scrape location configuration."""
|
||||
result = db.execute(
|
||||
text("""
|
||||
SELECT id, location_name, location_search_url, pages_to_scrape, adults
|
||||
SELECT id, location_name, location_search_url, pages_to_scrape, adults, dest_id
|
||||
FROM booking_scrape_config
|
||||
WHERE is_active = TRUE
|
||||
ORDER BY id
|
||||
|
|
@ -99,6 +99,7 @@ def get_scrape_config(db: Session) -> Optional[Dict[str, Any]]:
|
|||
'location_search_url': result.location_search_url,
|
||||
'pages_to_scrape': result.pages_to_scrape or 2,
|
||||
'adults': result.adults or 2,
|
||||
'dest_id': result.dest_id,
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -330,7 +331,8 @@ async def scrape_date(
|
|||
check_in=check_in,
|
||||
check_out=check_out,
|
||||
adults=config['adults'],
|
||||
pages=config['pages_to_scrape']
|
||||
pages=config['pages_to_scrape'],
|
||||
dest_id=config.get('dest_id'),
|
||||
)
|
||||
|
||||
if result.blocked:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue