Metadata-Version: 2.4
Name: booking-scraper-api
Version: 0.0.1
Summary: Python client for scraping Booking.com hotel rates and reviews using the ScrapingBee web scraping API
Author: wordstotech
License: MIT
Project-URL: Homepage, https://www.scrapingbee.com/scrapers/booking-api/
Keywords: booking api,booking scraper,booking scraper api,booking hotel scraper,travel booking api,scrapingbee
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests
Dynamic: license-file

# Booking Scraper API (Python)

A Python client for pulling hotel rate data off Booking.com search pages, built on the [ScrapingBee web scraping API](https://www.scrapingbee.com/features/ai-web-scraping-api/). Give it a destination and a pair of dates, and it returns a list of properties with name, nightly price, review score, and location as JSON. Rendering, residential proxies, and field extraction are handled on ScrapingBee's side.

Booking.com is one of the more defended travel sites, with heavy JavaScript and anti-bot challenges, so a direct request rarely returns usable data. This [Booking scraper](https://www.scrapingbee.com/scrapers/booking-api/) renders each search in a real browser and routes it through residential proxies, with a one-flag escalation to Stealth mode for pages that sit behind a challenge.

## Install

```bash
pip install booking-scraper-api
```

## Quickstart

```python
from booking_scraper_api import BookingScraper

scraper = BookingScraper(api_key="YOUR_SCRAPINGBEE_API_KEY")

result = scraper.search(
    destination="Rome, Lazio, Italy",
    checkin="2026-10-25",
    checkout="2026-10-26",
    adults=2,
    rooms=1,
)
for hotel in result["hotels"]:
    print(hotel["name"], hotel["price"], hotel["score"])
```

New accounts get 1,000 free credits at [ScrapingBee](https://www.scrapingbee.com/), no card needed.

## Returned data

`search()` returns a dictionary with a `hotels` list, one entry per property card:

```json
{
  "hotels": [
    {
      "name": "Hotel Example Roma",
      "price": "€180",
      "score": "8.9",
      "location": "Trevi, Rome"
    }
  ]
}
```

The fields map to the CSS selectors from ScrapingBee's [data extraction rules](https://www.scrapingbee.com/documentation/data-extraction/); pass your own `extract_rules` to pull amenities, room types, or photos as well.

## Methods and options

- **`search(destination, checkin, checkout, adults=2, rooms=1, offset=0, **options)`** returns structured hotels for one results page. Booking.com pages in steps of 25, so `offset=25` is page two.
- **`scrape(url, extract_rules=None, **options)`** fetches any Booking.com URL, returning HTML or JSON.

Options that override the defaults:

| Option | Default | Purpose |
|---|---|---|
| `render_js` | `True` | Render the page in a headless browser |
| `premium_proxy` | `True` | Route through residential proxies |
| `stealth_proxy` | `False` | Escalate to Stealth mode for anti-bot pages |
| `country_code` | `"us"` | Proxy country |
| `wait` | `5000` | Milliseconds to wait after load |

## When Booking blocks a plain request

If a search returns empty or a challenge page, set `stealth_proxy=True`. Stealth mode is built for aggressive anti-bot defenses and forces JavaScript rendering:

```python
result = scraper.search("Paris", "2026-11-10", "2026-11-12", stealth_proxy=True)
```

## Credit cost

With residential proxies and JavaScript rendering, each request costs 25 ScrapingBee credits. A Stealth request costs 75. See [ScrapingBee pricing](https://www.scrapingbee.com/pricing) for the full table before you scale.

## Requirements and scope

Python 3.8 or newer and a ScrapingBee API key. This is an independent wrapper on the public ScrapingBee API, not affiliated with Booking.com, and it targets public search pages only.

## Links

- [How to scrape Booking.com (ScrapingBee guide)](https://www.scrapingbee.com/blog/how-to-scrape-booking-com/)
- [ScrapingBee Booking scraper](https://www.scrapingbee.com/scrapers/booking-api/)
- [Data extraction rules](https://www.scrapingbee.com/documentation/data-extraction/)

## License

MIT
