Web Scraping Hotel Data Without any Coding Skills
Many hotel websites allow you to compare many different hotel prices that are in different cities all around the world!
Today, we’ll show you how you can scrape a hotel website like booking.com to export data like hotel name, rating, price and price comparisons!
For this example, we are going to extract hotel data from booking.com for hotels in Toronto. Will extract the hotel name, price, rating. We are going to export it as an excel/ CSV or JSON file
You can use this link if you want to follow along: Hotels in Toronto
So let’s get started!
Web scraping Hotel Data
While there are several web scraping tools, we think you’ll enjoy ParseHub! It’s free to use and has a suite of features like:
- IP Rotation
- Scheduling
- Cloud-based Scraping
- Many more!
- Once ParseHub is open, click on “New Project” and use the URL from the Booking.com result page. The page will now be rendered inside the app.
- For this example, we will switch into browse mode, close the date window, then switch browse mode back off
- Start by clicking on the first name of the first hotel name on the list. It will be highlighted in green to indicate it has been selected. On the left sidebar, rename your selection to “hotel_name”.
- Parsehub will now suggest the other data you want to be extracted in yellow. The rest of the hotels will now be highlighted in yellow. Click on the second hotel on the list to select them all. All hotels on the first page will be highlighted in green now. You are now collecting the name and URL listing of the models.
- Now let’s extract data like price, price comparisons and rating. To do this you will need to do a relative select command. Start by clicking on the PLUS(+) sign next to your hotel selection and choose the Relative Select command.
- Using the Relative Select command, click on the first hotel that is highlighted in orange and then on its price. An arrow will appear to show the association you’re creating.
- You might have to repeat this process for another hotel to fully train the scraper. On the left sidebar, rename your selection to “price”.
- Repeat steps 6-7 to pull more data for each Hotel to extract the data you want. We’re going to also extract the price comparisons and rating In this case. Your project should look somewhat like this:
Adding Pagination
If we were to start our project, we would only give extract the first page of hotels. We will now teach you how to add pagination to your web scraping project.
- Click the PLUS(+) sign next to your page selection and choose the “Select” command.
- Using the Select command, scroll down to the Next Page link. Click on it to select it and rename your selection to next_button.
- Click on the icon next to your next_button selection to expand it. Delete the command under the next selection.
- Click on the PLUS(+) sign next to your next selection and add a Click command.
- A pop-up will appear asking you if this is a “next page” link. Click on Yes and enter the number of times you’d like to repeat this process. In this case, we will repeat it 2 times.
Running your Scrape
It is now time to run your scrape. To do this, click on the green Get Data button on the left sidebar. Here you will be able to test, schedule, or run your scrape job.
For larger projects, we recommend that you always test your job before running it. In this case, we will run it right away.
Once your run is completed, you will be able to download it as an Excel or JSON file.
Enabling IP Rotation (Paid Feature)
If your web scraping project comes back blank, you may need to enable IP Rotation. You may be getting blocked from scraping the data, but IP rotation will allow you to still scrape the hotel data
If you’re getting blocked, let’s show you how you can enable IP Rotation.
Note: If you do enable IP rotation, your project will take longer to complete.
- Click on the gear icon, and then select settings
- Click on Rotate IP address
- A Popup will appear with to warning about your run speed, click on OK
Now run your project as normal.
Closing thoughts
Now you know how to scrape hotel data and export it into an excel/ CSV or JSON file.
We understand that web scraping projects can get quite complicated. If you run into any problems or have any questions, you can contact our customer support team using our live chat where we’ll be more than happy to assist you!
What will you scrape?
Happy Scrapping!