Booking Scraper
A working Booking scraper in Python and Node, built on the ScrapingBee web scraping API. It reads hotel name, nightly price, review score, and location off a Booking.com search page and returns them as JSON, with a Stealth escalation for pages that fight back.
Booking.com is a hard target. The results are rendered with JavaScript, and the site runs anti-bot challenges that stop a plain HTTP request cold. The working approach is to render the page in a real browser, route the request through residential proxies, and step up to Stealth mode when a challenge appears. ScrapingBee does all three from one call.
Point the ScrapingBee HTML API at a Booking.com search URL, turn on rendering and residential proxies, and pass extraction rules so the response comes back as JSON. The selectors below are from ScrapingBee’s Booking.com guide.
import json
import requests
API_KEY = "YOUR_SCRAPINGBEE_API_KEY"
search_url = (
"https://www.booking.com/searchresults.html"
"?ss=Rome%2C+Lazio%2C+Italy&checkin=2026-10-25&checkout=2026-10-26"
"&group_adults=2&no_rooms=1"
)
rules = {
"hotels": {
"selector": "div[data-testid='property-card-container']",
"type": "list",
"output": {
"name": "div[data-testid='title']",
"price": "span[data-testid='price-and-discounted-price']",
"score": "div[data-testid='review-score'] > div[aria-hidden='true']",
"location": "span[data-testid='address']",
},
}
}
response = requests.get(
"https://app.scrapingbee.com/api/v1/",
params={
"api_key": API_KEY,
"url": search_url,
"render_js": "true",
"premium_proxy": "true",
"extract_rules": json.dumps(rules),
},
timeout=90,
)
print(response.json())
Get a key with 1,000 free credits at ScrapingBee.
Fields this Booking hotel scraper returns
| Field |
CSS selector |
| Property card |
div[data-testid='property-card-container'] |
| Hotel name |
div[data-testid='title'] |
| Price |
span[data-testid='price-and-discounted-price'] |
| Review score |
div[data-testid='review-score'] > div[aria-hidden='true'] |
| Location |
span[data-testid='address'] |
Search URL parameters
Booking.com builds its search from query parameters, so you construct the URL rather than crawl a form:
| Parameter |
Meaning |
ss |
Destination (city or area) |
checkin / checkout |
Stay dates, YYYY-MM-DD |
group_adults |
Number of guests |
no_rooms |
Number of rooms |
offset |
Pagination, in steps of 25 |
When Booking throws a challenge
If a search comes back empty, swap premium_proxy for stealth_proxy. Stealth mode is built for aggressive anti-bot systems and always renders JavaScript:
params["stealth_proxy"] = "true" # replaces premium_proxy
Ready-made packages
The same client is packaged so you can skip the wiring:
pip install booking-scraper-api
from booking_scraper_api import BookingScraper
scraper = BookingScraper(api_key="YOUR_SCRAPINGBEE_API_KEY")
print(scraper.search("Rome, Lazio, Italy", "2026-10-25", "2026-10-26")["hotels"])
npm install booking-scraper-api
const { BookingScraper } = require('booking-scraper-api');
const scraper = new BookingScraper({ apiKey: 'YOUR_SCRAPINGBEE_API_KEY' });
scraper.search('Rome, Lazio, Italy', { checkin: '2026-10-25', checkout: '2026-10-26' })
.then((r) => console.log(r.hotels));
Credit cost
A residential request with rendering runs at 25 ScrapingBee credits. Stealth, which you want for Booking’s tougher pages, runs at 75. The ScrapingBee pricing page has the complete credit table, so you can budget a large travel booking API job in advance.
FAQ
How do you scrape hotel data from Booking.com?
Build a Booking.com search URL from the destination and dates, send it through a scraping API with JavaScript rendering and residential proxies, and extract the property cards with CSS selectors. The Python example above returns clean JSON.
What makes a good booking scraper API?
Two things carry most of the weight: reliable fetching against Booking’s anti-bot layer (residential and Stealth proxies plus real rendering) and stable extraction (CSS selectors or server-side extraction rules). Keeping those separate means a markup change only touches the selectors.
Can I pull rates for specific dates?
Yes. The checkin and checkout query parameters set the stay window, and group_adults and no_rooms set occupancy, so each request returns rates for the exact dates you ask for.
Is it allowed to scrape Booking.com?
Scrape only public, pre-login search and property pages, and follow the site terms and applicable law. ScrapingBee prohibits scraping behind a login, so this Booking hotel scraper targets public pages only.
Links
License
MIT
评论