To scrape data off of hotel and airline booking sites like TripAdvisor, airbnb, booking.com, Expedia, and so on, you often have to enter a location in a search field, and a date in a calendar dropdown.
This tutorial will show you how to navigate to a results page by inputting a city of your choice, and the current date. If you wanted to scrape multiple cities, you can follow our tutorial on entering multiple keywords into a search field.
I'll be using http://www.booking.com/ for this tutorial, if you want to follow along.
Input the name of the city
1. Start a new project on http://www.booking.com/, and click on the "Destination" search field to select it.
2. ParseHub will automatically create an Input command.
3. Type the city you want to search for into the Input box. I used Toronto.
Pick out the current date
4. Press the plus button to the right of Select page command. Add a new Select command.
5. Click on the calendar icon next to "Check-in" to select it.
6. Press the plus button to the right of the Select command. Add a new Click command.
7. In the pop-up that appears, click "No" when asked if this is a "next page" button and make sure to Continue executing the current template and press the green button to add the command. This will bring up the calendar.
8. Hold down the Shift key on your keyboard and hover over the select command. Press the + button that appears and add a new Select command.
9. Click on the current date on the calendar that appears.
10. Press the + button to the right of the new Select command. Add a new Click command.
11. In the pop-up that appears, choose "No" again when asked if this is a "next page" button, make sure to Continue executing the current template and press the green button to add the command.
Searching and scraping the results
12. Press the + button to the right of Select page command. Add a new Select command.
13. Click on the "Search" button to select it.
14. Press the + button to the right of the new Select command. Add a new Click command.
15. In the pop-up that appears, choose "No" when asked if it is a "next page" button, then select Create New Template and input results_template in the "template name" field. Press the green button to add the command and load the search page.
16. On the new page, you can now select and extract the data from various elements on the page.