Step-by-step tutorials for you to get started with web scrapingDownload Octoparse
Scrape hotel data from Booking.comThursday, November 01, 2018
In this tutorial, we are going to show you how to scrape hotel information from Booking.com.
To follow through, you may want to use this URL in the tutorial:
We will enter each hotel page and scrape the details including the hotel name, rating, address, one photo, and room facilities.
1. We strongly recommend to set up the filters as you need in your own browser and enter the configured URL into Octoparse to start the task.
2. The structure and display of Booking.com might vary depending on your IP and preferred language.
Here are the main steps in this tutorial: [Download demo task file here ]
1) Go To Web Page - to open the targeted web page
· Click "+ Task" to start a task using Advanced Mode
Advanced Mode is a highly flexible and powerful web scraping mode. For people who want to scrape from websites with complex structures, like Booking.com, we strongly recommend Advanced Mode to start your data extraction project.
· Paste the URL into the "Extraction URL" box and click "Save URL" to move on
2) Create a pagination loop - to scrape all the results from multiple pages
· Turn on the “Workflow Mode” by switching the "Workflow" button in the top-right corner in Octoparse
We strongly suggest you turn on the "Workflow Mode" to get a better picture of what you are doing with your task, just in case you mess up with the steps.
· Scroll down the page and click the next page button ">"
· Click "Loop click the selected link" from "Action Tips"
3) Create a "Loop Item" - to loop click into each item on each list
· Click "Go To Web Page" to go to the first page
When extracting data throughout multiple pages, you should always begin your task building on the first page.
· Click the first hotel link on the page
· Click "Select all" on "Action Tips"
Octoparse will automatically select all the links to the detail pages on the current page. The selected links will be highlighted in green while other links to the detail pages will be highlighted in red.
· Click "Loop click each element" to create a "Loop Item"
Octoparse will click through each link captured in the "Loop Item", and open the detail page.
4) Extract data - to select the data for extraction
After you click "Loop click each element", Octoparse will open the detail page of the first hotel.
· Click on the data you need on the page
· Extract the selected data
· For extracting the text, select "Extract text of the selected element" from "Action Tips"
· For extracting the image URL, select "Extract the URL of the selected link" from "Action Tips"
· Rename the fields by selecting from the pre-defined list or inputting on your own
5) Start extraction - to run the task and get data
· Click “Start Extraction” on the upper left side
· Select “Local Extraction” to run the task on your computer, or select “Cloud Extraction” to run the task in the Cloud (for premium users only)
Here is the sample output. You can see some blank fields in the column “Hotel_Image_1” and column "All_Rooms_Include". This is because some detail pages do not contain any image of the hotel and/or the information of room facilities.
By default, if Octoparse cannot find the element of the defined pattern on the page, the field will be left blank. However, Octoparse may fail to find the element of the defined pattern even if the element needed is shown on the website. If you encounter this problem, here are a related tutorial you might need：
Was this article helpful? Feel free to let us know if you have any question or need our assistance.
Contact us here !
- Most popular tutorials
- Extract multiple pages through pagination
- Scraping info from Craigslist
- Scraping search results from Google Scholar
- Scraping restaurant info from Grubhub
- Scrape product images from eBay