Limited Time Offer: Use code CYBER at checkout and get 50% off for your 1st month! Start Free Trial 🐝

How to Scrape Booking.com: Step-by-Step Tutorial

01 October 2025 | 11 min read

Booking.com is one of the biggest travel platforms, and a go-to choice for millions of users planning their trips and vacations. By accessing the platform using automated tools, we can collect hotel data, including names, ratings, prices, and locations, for research or comparison purposes.

However, the platform’s strict anti-bot systems make direct extractions nearly impossible. Fortunately, our API and implementation of Python tools eliminate these challenges by providing automatic JavaScript execution, proxy rotation, and CAPTCHA-resistant browsing.

In this tutorial, we will cover the basic steps on how to scrape Booking.com. With just a few lines of Python code, you can render hotel pages, extract structured data, and export it into a clean CSV file without setting up headless browsers or worrying about IP bans!

Quick Answer (TL;DR)

Booking.com is difficult to scrape due to dynamic JavaScript content and strong anti-bot protection. You can avoid these issues with our Booking.comScraper API and use built-in headless rendering with residential proxy rotation. With minimal coding knowledge, you can extract hotel names, prices, ratings, and locations in a single Python API call with our SDK.

Scrape Booking.com with ScrapingBee

Make sure Python 3.6 or newer is installed before you begin. You can grab it from the official Python website, install it via the Microsoft Store by searching “Python", or download it using the package manager of your Linux distribution.

Python

One great thing about Python is how easily it supports third-party libraries. Pip, Python’s package installer, can install additional external tools that simplify automatic data extraction. Open your Terminal (or Command Prompt on Windows) and run: pip install <package-name>. For our Booking.com scraper, you will only need two extra packages:

  • scrapingbee – our Python Software Development Kit (SDK) that can send API calls, handle headless browsers, route connections through remote proxies to avoid IP blocks, and interact with JavaScript elements on the site.

  • pandas – a powerful toolkit for data analysis and manipulation that cleans and reorganizes information from raw HTML into a structured format, ready for export to CSV format for further analysis.

To install these packages, open your Terminal, or Command Prompt on Windows devices, and enter this pip command:

pip install scrapingbee pandas

Set Up ScrapingBee and Your Environment

To get started, visit our website and either log in or sign up for a ScrapingBee account. After registration, you will receive 1,000 free credits valid for 7 days, giving you room to test the scraping logic, automatically access publicly available data, and test performance before making any financial commitments.

Register

Set Up ScrapingBee API Key

With your account ready, the first thing you will see is a dashboard with a summary of your usage and remaining credits. Go ahead and copy the API key. We’ll use it to connect the script to our services.

Dashboard

Next, choose a suitable folder for your project and create a new file named something like Booking_Scraper.py. The .py extension tells your system it’s a Python script, signaling code interpreters to apply syntax highlighting to the file.

Note: Python files can be configured on any text editor, but we highly recommend using a dynamic IDE like VSCode, where you can download the IntelliSense to track your code mistakes in real time – a great way to learn coding and only send properly structured API requests to not waste credits.

Then, begin your script by importing the downloaded external libraries: our Python SDK and the Pandas library for restructuring data into organized data frames.

#Importing our HTML API
from scrapingbee import ScrapingBeeClient
# pandas dataframes for better data formatting
import pandas as pd

Note: Python comment lines, starting with a hash symbol or triple quotes, are ignored by the interpreter. Our code examples use them to explain and clarify written code.

After that, we created a "client" variable that initializes our scraping client and the previously copied key to authorize access to the API. Then, add a base URL that will be configured based on your search query:

# Initializing our API client in the "client" variable
client = ScrapingBeeClient(api_key='YOUR_API_KEY')

# URL for Hotels in Rome
url = "https://www.booking.com/searchresults.html?ss=Rome%2C+Lazio%2C+Italy&efdco=1&label=gen173nr-10CAEoggI46AdIM1gEaIgBiAEBmAEzuAEXyAEM2AED6AEB-AEBiAIBqAIBuALEg5_GBsACAdICJGQyN2IzZDFmLWYwYWMtNDdiNi04NWUyLTg0MDcxNzJhYzgyYdgCAeACAQ&aid=304142&lang=en-us&sb=1&src_elem=sb&src=index&dest_id=-126693&dest_type=city&ac_position=0&ac_click_type=b&ac_langcode=en&ac_suggestion_list_length=5&search_selected=true&search_pageview_id=5240356247c801ad&ac_meta=GhA1MjQwMzU2MjQ3YzgwMWFkIAAoATICZW46BFJvbWVAAEoAUAA%3D&checkin=2025-10-25&checkout=2025-10-26&group_adults=2&no_rooms=1&group_children=0"

Note: Booking.com pages are very hard to scrape because their URL structure does not display the information about the selected date and location. In this tutorial, we are using a static link for hotels in Rome in October.

Once the API key is attached to the client, we can open a function definition that will contain our web scraping logic. Add the following section: line indentation will highlight which parts are within the "scrape_booking" function.

# Start the function definition, the indented lines define its boundaries
def scrape_Booking()

Our API simplifies data collection from dynamic content platforms like Booking.com, with JavaScript Rendering rules enabled by default for each session. This means your GET API calls will use a headless browser solution, and a "js_scenario" dictionary defines a custom script that interacts with the platform before extracting data.

In it, you can put different ways to interact with the site. For this tutorial, we will add a "wait: 3000" parameter to allow the page to load hotel listing cards and their pricing data. If you want to find more ways to customize JavaScript execution, check out our extensive page on ScrapingBee Documentation.

    # Rules for JavaScript Rendering
    js_scenario = {
        "instructions": [
            {"wait": 3000}
        ]
    }

Make Your First API Call to Booking.com

Okay, now for the main part – it's time to send the GET API request. Create a new variable; we named it "response". Here we assign the previously created "client" variable (the one with your API key), and call its "get" method. Then, in the parentheses, add the URL and add our js_scenario parameter.

To ensure consistent access to the platform and get more control over your connections, our GET API call accepts additional parameters that are not defined within the script, which you can find on our documentation page. Alongside the "js_scenario" parameter, we added a 'premium_proxy': 'True' line, which will route the connection through our robust network of residential proxies.

    response = client.get(
        url,
        params={
        "js_scenario": js_scenario,
        'premium_proxy': 'True'
                }
        )

Let's assign our results to the "results" variable, which will invoke the response's "text" method to extract the contents. Then, our last lines of code within the function will the printing the result and the HTTP error status code in case the extraction fails (200 is OK).

After putting everything together, we can close the function. The last line is not indented and calls for the execution of our scraping script:

scrape_Booking()

Once everything is in check, it is time to run the script and extract hotel details. After the first execution, your result should look something like this:

CMD

Note: If the script fails to access the site or does not load the information properly, check out our customization options in the JavaScript Scenario Docs to add additional steps for interacting with the platform to ensure detailed data access.

Extract Hotel Data with CSS

Now, to remove the clutter and display the extracted information. To achieve this goal, we have to create another dictionary variable – "extract_rules". Let's break down the extract rules definition, going over each component within the list:

  • "selector" – defines the container for each hotel listing card, instructing the CSS selector within our Python SDK to only extract information within its boundaries

  • "type" – picks the type of extracted information. Choosing "list" will output information from all available property cards on the loaded page.

  • "Name" – a specific CSS selector for extracting the text from a <div> element that contains the name of the hotel.

  • "Price" – extracts the price of a displayed hotel for the shown search results through its CSS selector

  • "Score" – a CSS selector that shows how the hotel is rated by its visitors.

  • "Location" – targets a CSS selector to extract the property address from HTML data.

To find these CSS selectors, we have to inspect the platform manually before automatic extraction. Go to Booking.com through your browser, and then click F12 to open developer tools. They will display raw HTML data, and we can right-click specific data points on the rendered page and click "Inspect" to see where all the elements are within the code.

Our main selector, which contains all hotel information and key details, is shown in the image below. Pay attention to the developer tools' search bar, accessed by clicking Ctrl+F after clicking F12. You can type in CSS selectors in there to test before putting them in your script.

Class

All the pricing information and other property details will be extracted from these boundaries for each listing card. For example, here is a CSS selector for our "Price" variable:

Class

Note: To find more ways to extract data points using CSS selectors or other techniques, check out our Data Extraction Documentation page.

After extracting hotel pricing and other data from each hotel listing card, your "extract_rules" variable should look something like this:

       #Extract rules definition
    extract_rules = {
    "Search_Result": {
        "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']"
           }
        },

Before we print the valuable data, make sure to change the method of the "Data" variable, outputting result.json() instead of result.text:

    result=(response.json())

After that, run the code. The result will be a lot different, finally securing useful data extraction for your Booking scraper:

CMD

Export scraped Booking data to a CSV file

After a successful extraction and its printed presentation, we can append the code to create and export data points into a CSV file in your project folder. This type of representation is much more suitable for a human user to read, and the data set can be expanded to accommodate large-scale scraping needs.

Now all we need are two lines of code: one that appends our scraping workflow by transforming collected data into a Pandas dataframe. Then, the next line converts aggregated search page results into a CSV file:

    Data=pd.DataFrame(result['Search_Result'])
    Data.to_csv('Booking_scraper.csv', index=False)

If the code is executed successfully, your CSV file will appear in the project folder. Here is how the result looks when it is opened in Google Sheets:

Table

Full Code Example (Python)

Below is the finalized Python code that will let you instantly extract data from Booking.com. It includes JavaScript rendering, proxy handling, and automatic CSV export, giving you a full working example to modify for your own searches or destinations. Give it a different URL with specific date ranges, checkout dates, and other details, plus adjust as you go to extract desired data points without IP blocks!

#Importing our HTML API
from scrapingbee import ScrapingBeeClient 
# pandas dataframes for better data formatting
import pandas as pd 
# Initializing our API client in the "client" variable
client = ScrapingBeeClient(api_key='YOUR_API_kEY')


url = "https://www.booking.com/searchresults.html?ss=Rome%2C+Lazio%2C+Italy&efdco=1&label=gen173nr-10CAEoggI46AdIM1gEaIgBiAEBmAEzuAEXyAEM2AED6AEB-AEBiAIBqAIBuALEg5_GBsACAdICJGQyN2IzZDFmLWYwYWMtNDdiNi04NWUyLTg0MDcxNzJhYzgyYdgCAeACAQ&aid=304142&lang=en-us&sb=1&src_elem=sb&src=index&dest_id=-126693&dest_type=city&ac_position=0&ac_click_type=b&ac_langcode=en&ac_suggestion_list_length=5&search_selected=true&search_pageview_id=5240356247c801ad&ac_meta=GhA1MjQwMzU2MjQ3YzgwMWFkIAAoATICZW46BFJvbWVAAEoAUAA%3D&checkin=2025-10-25&checkout=2025-10-26&group_adults=2&no_rooms=1&group_children=0"


# Start the function definition, the indented lines define its boundaries
def scrape_Booking():
    # Rules for JavaScript Rendering
    js_scenario = {
        "instructions": [
            {"wait": 3000}
        ]
    }
    #Extract rules definition
    extract_rules = {
    "Search_Result": {
        "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 = client.get(
        url,
        params={
        "js_scenario": js_scenario,
        "extract_rules": extract_rules,
        'premium_proxy': 'True'
                }
        )
    result=(response.json())
    Data=pd.DataFrame(result['Search_Result'])
    Data.to_csv('Booking_scraper.csv', index=False)
    print(response.status_code)
    print(Data)
        
scrape_Booking()

Try ScrapingBee for Booking.com Today

Scraping hotel data from Booking.com is already hard enough due to many restrictions on the platform and how it loads its content. Don't make your job harder than it has to be – with our HTML API, you can extract hotel names, prices, ratings, and locations utilizing our JavaScript rendering tools and parameters that will help you bypass automated blocks.

Sign up for a free ScrapingBee account and get 1,000 free credits to test your public data scraping capabilities! Register today and make use of our sophisticated Python SDK and begin extracting data points, even from the most resilient public data platforms.

Frequently Asked Questions (FAQs)

Can I scrape Booking.com with Python and ScrapingBee?

Yes. Our beginner-friendly Python SDK makes it easy to extract Booking.com data because it handles proxy connections, customizes JavaScript rendering, and handles anti-bot detection for you. You can pull hotel names, prices, and ratings in one API call, with more options covered in our Python Web Scraping Tutorial.

Why does Booking.com block my scraper?

Booking.com uses strict bot-detection systems to stop automated connections from scraping publicly available data. IP bans, CAPTCHA, and JavaScript-based content are common challenges for extracting data from a specified URL. Our API bypasses these issues with secure residential connections and browser emulation tools.

Can I get prices, reviews, and location info from Booking.com?

Yes. With proper CSS selectors in your "extract_rules", you can use our Python SDK to pull structured data like specific hotel prices, guest ratings, and location details from Booking.com pages into clean CSV or JSON files.

How do I bypass JavaScript and dynamic content?

Use our built-in JavaScript rendering tools. Our SDK executes our API calls in a headless browser, ensuring all Booking.com elements are fully loaded before extraction.

image description
Kevin Sahin

Kevin worked in the web scraping industry for 10 years before co-founding ScrapingBee. He is also the author of the Java Web Scraping Handbook.