Menu

How to scrape hotel prices with Python (Booking.com and Google Hotels)
📰

How to scrape hotel prices with Python (Booking.com and Google Hotels)

DEV Community: datascience·elliott maqy·8 days ago
#4rLisjdW
#devtodatascience#science#devto#dev#hotels
Reading 0:00
15s threshold

Hotel prices are spread over many sites, and two of them give a good picture of a city: Booking.com, with its own rates and guest scores, and Google Hotels, which shows the lowest price among dozens of booking sites for each hotel. Reading one without the other gives half of it. This tutorial scrapes hotel prices from both with Python, for the same city and the same dates, and puts them in a single pandas table: all-in prices per night, guest scores on the same scale, a summary by star class and a hotel-by-hotel comparison. The data comes from two Apify Actors, the Booking.com Hotels Scraper and the Google Hotels Scraper , called through the official Python client.

What you need

An Apify account (the free plan is enough to try this) and its API token, from Apify Console → Settings → API & Integrations, exported as an environment variable: export APIFY_TOKEN=...

Python 3 and two packages:

pip install "apify-client>=3,<4" pandas

Enter fullscreen mode

Exit fullscreen mode

The two Actors return the same…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.