All Collections
Case Tutorial
Travel
Scrape hotel data from Booking
Scrape hotel data from Booking
Updated over a week ago

You are browsing a tutorial guide for the latest Octoparse version. If you are running an older version of Octoparse, we strongly recommend you upgrade because it is faster, easier, and more robust! Download and upgrade here if you haven't already done so!

In this tutorial, we are going to show you how to scrape hotel information on Booking.com.

Also, you can go to "Task Templates" on the main screen of the Octoparse scraping tool, and start with the ready-to-use Booking Template directly to save your time. With this feature, there is no need to configure scraping tasks. For further details, you may check it out here: Task Templates

If you would like to know how to build the task from scratch, you may continue reading the following tutorial.

We will scrape data such as hotel names, images, addresses, descriptions, scores, reviews, and star ratings with Octoparse.

The main steps are shown in the menu on the right.

[Download the demo task here]


1. Go to the web page - open the target web page

  • Input the URL to the home page

  • Click on Start button


2. Auto-detect the web page - create a workflow

  • Click Auto-detect web page

  • Uncheck the Add a page scroll after the detection completes

  • Click Create a workflow

  • Adjust the order for the fields as you want

11.gif
  • Delete and rename the field

It is quite convenient to delete the fields that you don't want together after auto-detection.

Click the vertical view icon to switch to vertical view to delete and rename the fields. Note that you need to double-click on the field name to rename it.

12.gif

If you want to click on each detail link to get more information, please follow the next steps.


3. Click into each detail link - scrape more information

  • Choose to Select subpage URL on the Tips panel

  • Select Click on an extracted data field and select the one you want to click on from the drop-down menu (you can confirm if it's the correct link in the Data Preview)

  • Click on Confirm


4. Extract Data - extract data on the detail pages

If there is a pop-up, turn on browse mode to close it manually. Then turn it off.

  • Select the data you need and click Element data

  • Double-click on the field name to rename it if needed

rename.png

5. Set up wait time - slow down the scraping speed

Booking might block your IP if you scrape it too much, therefore we need to control the scraping speed.

4.png

6. Modify XPath of the Pagination

The auto-generated XPath of Pagination does not always locate the next page button, so we need to modify the XPath.

  • Click on Pagination

  • Replace the XPath with //button[@aria-label="Next page"]

  • Click Apply to save

pagination.png

TIP: Check out this tutorial to learn more about Path: What is XPath and how to use it in Octoparse


7. Start extraction- run the task and get data

  • Click Save

  • Click Run on the upper left side

  • Select Run on your device to run the task on your computer, or select Run task in the Cloud to run the task in the Cloud (for premium users only)

Here is the sample output -

google_2.png
Did this answer your question?