TripAdvisor offers online hotel reservations and bookings for transportation, lodging, travel experiences, and restaurants. Users can find better service by comparing the hotels or restaurants on the platform to enjoy their trip better.

In this tutorial, we are going to show you how to scrape hotel data from Tripadvisor.

For Tripadvisor scraping, you could use our ready-to-use Task Template available on the home page or follow this tutorial to build the task from scratch.

mceclip0.png

To demonstrate, we will use this URL as an example: https://www.tripadvisor.com/Hotels-g186338-London_England-Hotels.html

Here are the main steps in this tutorial: [Download task file here]

  1. Create a Go to Web Page - to open the target Webpage

  2. Click See all - to load all hotels

  3. Create Pagination - to scrape from multiple pages

  4. Create a Loop Item- to scrape data from the listing

  5. Save and run task - to get data


1. Create a Go to Web Page - to open the target Webpage

  • Paste the URL and click Start

mceclip4.png

2. Click See all - to load all hotels

We need to click on the See all button first to show all the hotels.

  • Select the See all button

  • Choose the Click Button on the Tips

click_see_all.png
  • Set up AJAX as 5s

Setup_AJAX.png

3. Create Pagination - to scrape from multiple pages

  • Scroll down to find the paging button (Next) and click on it

  • Select Loop click next page

  • Adjust Set AJAX timeout to 10s

sto.gif

4. Create a Loop Item- to click on each hotel to get data

  • Click on 2 random hotel titles

  • Select Loop click each URL

sto.gif
  • Click on each data that needs to be extracted

  • Select Extract the text of the element

  • Repeat until all data needed are in place

sto.gif
  • Go to Data Preview, double click to rename the field

sto.gif
  • Modify the XPath of the Loop Item to //a[@data-clicksource="HotelName"]

Loop_Item_XPath.png

Below is what the final workflow looks like. If everything is in place, you can continue to run the task

mceclip0.png

5. Save and run task - to get data

  • Run the task on the top right corner

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

run.png

Here is the sample output:

mceclip15.png
Did this answer your question?