Skip to main content

A fast, simple hotel scraper for Google Hotels, inspired by fast-flights.

Project description

fast-hotels

A fast, simple hotel scraper for Google Hotels, inspired by fast-flights. Fetches hotel data (name, price, rating, amenities, etc.) using Playwright, with a simple synchronous API.

Features

  • Scrape Google Hotels for hotel data
  • Simple, synchronous API (no Playwright or async knowledge needed)
  • Returns structured hotel data (name, price, rating, amenities, ...)
  • Sort results by price, rating, or best value (rating/price ratio)
  • Limit the number of results returned
  • Support for IATA airport codes as locations (e.g., 'CDG' → 'Charles de Gaulle Airport')
  • Validates that check-in date is not in the past

Installation

pip install fast-hotels
# Then install Playwright browsers:
python -m playwright install

Usage

from fast_hotels import HotelData, Guests, get_hotels

hotel_data = [
    HotelData(
        checkin_date="2025-06-23",
        checkout_date="2025-06-25",
        location="Tokyo"  # or use an IATA code like "CDG"
    )
]
guests = Guests(adults=2, children=1)

# Basic usage
result = get_hotels(hotel_data=hotel_data, guests=guests, fetch_mode="live")
for hotel in result.hotels:
    print(f"Name: {hotel.name}, Price: {hotel.price}, Rating: {hotel.rating}, Amenities: {hotel.amenities}")

# Limit results to 5 hotels
result = get_hotels(hotel_data=hotel_data, guests=guests, fetch_mode="live", limit=5)

# Sort by price (descending)
result = get_hotels(hotel_data=hotel_data, guests=guests, fetch_mode="live", sort_by="price")

# Sort by rating (descending)
result = get_hotels(hotel_data=hotel_data, guests=guests, fetch_mode="live", sort_by="rating")

# Default sort is by best value (highest rating/price ratio)
result = get_hotels(hotel_data=hotel_data, guests=guests, fetch_mode="live")

# Use an IATA airport code as location
hotel_data = [HotelData(checkin_date="2025-06-23", checkout_date="2025-06-25", location="CDG")]
result = get_hotels(hotel_data=hotel_data, guests=guests, fetch_mode="live")

API

get_hotels(hotel_data, guests, fetch_mode="live", debug=False, limit=None, sort_by=None)

  • hotel_data: List of HotelData (checkin_date, checkout_date, location)
  • guests: Guests (adults, children)
  • fetch_mode: "live" (scrape Google) or "mock" (return sample data)
  • debug: If True, enables debug mode in scraper
  • limit: Maximum number of hotels to return (default: all)
  • sort_by: 'price', 'rating', or None (default: best value, i.e., highest rating/price ratio)
  • Returns: Result with .hotels (list of Hotel)

Models

  • HotelData: checkin_date, checkout_date, location (city name or IATA airport code)
  • Guests: adults, children
  • Hotel: name, price, rating, amenities, ...
  • Result: hotels (list of Hotel)

Playwright

This package uses Playwright. After install, run:

python -m playwright install

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fast_hotels-0.1.5.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fast_hotels-0.1.5-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file fast_hotels-0.1.5.tar.gz.

File metadata

  • Download URL: fast_hotels-0.1.5.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for fast_hotels-0.1.5.tar.gz
Algorithm Hash digest
SHA256 17a7debc1f03a2e06196e47c0f7ed815effae91c61e165c830dcf240e5dad857
MD5 09f8300d5aef4c7bfa91d104044a65a1
BLAKE2b-256 e98fdc479193418ee4eed6e183977f5ebd175a83cbf572af602c9d66b2f5a480

See more details on using hashes here.

File details

Details for the file fast_hotels-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: fast_hotels-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for fast_hotels-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 c98443ea5d9ba4ea026ad51c3d8c30625700b8be82c9f46cfe1a32b0b5241896
MD5 811a609e47924b66594b2aeeda3de612
BLAKE2b-256 dc630574e2742d8391a88cfce0f8691703f0086a5f29002b2e9164dc32691bc9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page