Combines Booking.com Playwright scraper (from forecasting), direct booking engine scraper (ported from laptop-archive/guestline-monitor), and Newbook own-hotel rates into one focused tool. Four views: Bookability, Market View (with price index badges + direct rate sub-rows), Direct Rates (per-competitor room breakdown, min-stay flags, hotel config/discovery), Rate Analysis (advance purchase curve, DOW chart, rate timeline, comparison table). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
25 lines
1,004 B
Python
25 lines
1,004 B
Python
from abc import ABC, abstractmethod
|
|
|
|
|
|
class BaseProfile(ABC):
|
|
name: str = ""
|
|
label: str = ""
|
|
# Fields required to configure this engine, shown in the add-hotel form
|
|
# Each entry: {"key": "hotel_id", "label": "Hotel ID", "help": "e.g. THREEWAYS"}
|
|
required_params: list[dict] = []
|
|
|
|
@classmethod
|
|
@abstractmethod
|
|
def detect(cls, url: str) -> dict | None:
|
|
"""Return extracted params dict if URL matches this engine, else None."""
|
|
|
|
@abstractmethod
|
|
async def fetch_arrival_dates(self, client, params: dict) -> list[str]:
|
|
"""Return list of bookable arrival date strings YYYY-MM-DD."""
|
|
|
|
@abstractmethod
|
|
async def fetch_night_rates(self, client, params: dict, arrival: str, nights: int = 1) -> list[dict]:
|
|
"""Return list of room/rate dicts for the stay.
|
|
Each dict must have: roomId, rateId, availability, prices[{amountBeforeTax, amountAfterTax}], currencyCode
|
|
prices list has one entry per night when nights > 1.
|
|
"""
|