When planning trips, most travellers turn to Google to find hotels. The platform shows hotel listings, prices, reviews, and availability all in one place. For businesses, analysts, or travel platforms, this data is gold. Scraping Google Hotels can help you track pricing trends, monitor competitors, and analyze market opportunities in the travel industry.
In this guide, we’ll show you how to scrape Google Hotels using Python and the Crawlbase Crawling API. With this method, you can collect hotel data at scale without worrying about blocks, CAPTCHAs, or IP bans. We’ll cover everything from setting up your environment to writing a complete scraper for hotel listings and individual hotel pages.
Google Hotels is one of the most used platforms to find and compare hotel listings. It shows prices, locations, reviews, and booking options – all in one place. By scraping Google Hotels, you can collect data for price monitoring, competitor analysis, and travel market insights.
Here are some common use cases for scraping Google Hotels:
Track Hotel Prices: See how prices change over time across locations and seasons.
Compare Competitors: See how other hotels are rated, priced, and available.
Travel Research: Build tools that show the best hotel deals, travel patterns, or destination popularity.
Data for Machine Learning: Use historical data to forecast hotel demand or price trends.
Scraping this data manually is time-consuming, but with Python web scraping, you can automate the process and get structured hotel data in no time.
Key Data to Extract from Google Hotels
When scraping Google Hotels, it’s important to know which data points matter most. These details are useful for price monitoring, competitive analysis, and building travel tools.
The image below shows some of the most valuable fields you can extract:
Crawlbase Crawling API for Google Hotels Scraping
Scraping Google Hotels can be tricky because the site uses JavaScript to load hotel listings and details. Traditional scraping methods often don’t get the full HTML content. That’s where Crawlbase Crawling API comes in.
Crawlbase Crawling API makes Google Hotels scraping easy by handling JavaScript rendering, rotating IPs to avoid blocks, fast and reliable data extraction, and custom request options to mimic real users.
Crawlbase Python Library
To make it even easier, Crawlbase provides a Python library to interact with the Crawling API. All you need is a Crawlbase access token, which you get after signing up (we offer 1,000 free requests without needing a credit card).
Here’s a basic example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
from crawlbase import CrawlingAPI
# Initialize Crawlbase API with your access token crawling_api = CrawlingAPI({ 'token': 'YOUR_CRAWLBASE_TOKEN' })
if response['headers']['pc_status'] == '200': html_content = response['body'].decode('utf-8') return html_content else: print(f"Failed to fetch the page. Status code: {response['headers']['pc_status']}") returnNone
With this setup, you’ll be ready to start extracting hotel listings and details from Google Hotels. In the next section, we’ll set up the Python environment to begin scraping.
Setting Up Your Python Environment
Before scraping Google Hotels, you need to prepare your Python environment. This includes installing Python itself and a few essential libraries for sending requests and extracting data.
🐍 Install Python
If you haven’t installed Python yet, download and install the latest version from the official Python website. During installation, make sure to check the box that says “Add Python to PATH“ — this will let you run Python from the command line.
To check if Python is installed, run this in your terminal or command prompt:
1
python --version
You should see the installed version number.
✅ Install Required Libraries
To scrape Google Hotels, we’ll use:
carwlbase – to send HTTP requests use Crawlbase Crawling API.
beautifulsoup4 – to parse and extract content from HTML.
Install them using pip:
1 2
pip install requests pip install beautifulsoup4
📝 Create Your Python File
Create new files where you’ll write your scraping code, for example:
Or just create them manually in your preferred code editor.
🔑 Get Your Crawlbase Token
If you haven’t already, sign up at Crawlbase and get your API token. You’ll need this token to authenticate your scraping requests.
1 2 3 4
from crawlbase import CrawlingAPI
# Replace CRAWLBSE_JS_TOKEN with your actual token. crawling_api = CrawlingAPI({ 'token': 'CRAWLBASE_JS_TOKEN' })
Note: Crawlbase provides two types of tokens. A normal token for static sites and a JS Token for JS-rendered sites. For Google Hotels scraping, we need a JS token. See the documentation for more.
Now, your setup is complete. Next, we’ll inspect the HTML structure of Google Hotels and start writing the scraper.
Scraping Google Hotels Search Results
In this section, we’ll scrape hotel listings from Google Hotels using Python, BeautifulSoup, and the Crawlbase Crawling API. You’ll learn how to extract hotel details, handle pagination, and save data into a JSON file.
🧩 Inspecting the HTML for Selectors
First, open Google Hotels in your browser, search a location (e.g., “New York”), and inspect the page.
Here are some key CSS classes used in the hotel listings:
Hotel card:div.BcKagd
Hotel name: h2.BgYkof
Price: span.qQOQpe.prxS3d
Rating: span.KFi5wf.lA0BZ
We’ll use these selectors in our scraper.
🧪 Writing the Hotels Listings Scraper
Now, let’s write a function to extract hotel data using Crawlbase and BeautifulSoup.
hotels = soup.find_all("div", class_="BcKagd") for hotel in hotels: name = hotel.find("h2", class_="BgYkof") price = hotel.find("span", class_="qQOQpe prxS3d") rating = hotel.find("span", class_="KFi5wf lA0BZ") link = hotel.find("a", class_="PVOOXe")
hotel_data.append({ "name": name.text if name else"N/A", "price": price.text if price else"N/A", "rating": rating.text if rating else"N/A", "link": "https://www.google.com" + link["href"] if link else"N/A" })
return hotel_data
🔁 Handling Pagination
Google Hotels loads more results across multiple pages. Using the Crawlbase Crawling API, we can simulate button clicks with the css_click_selector parameter. We can also use the ajax_wait parameter to make sure the content is fully loaded after the click. This ensures the Crawling API returns the full HTML of the next page after the button is clicked and the content is rendered.
Let’s update our make_crawlbase_request function to include these parameters and add exception handling for better reliability:
hotels = soup.find_all("div", class_="BcKagd") for hotel in hotels: name = hotel.find("h2", class_="BgYkof") price = hotel.find("span", class_="qQOQpe prxS3d") rating = hotel.find("span", class_="KFi5wf lA0BZ") link = hotel.find("a", class_="PVOOXe")
hotel_data.append({ "name": name.text if name else"N/A", "price": price.text if price else"N/A", "rating": rating.text if rating else"N/A", "link": "https://www.google.com" + link["href"] if link else"N/A" })
if page_count == 0: # For 1st page html = make_crawlbase_request(url) else: # For next pages html = make_crawlbase_request(url, 'button[jsname="OCpkoe"]')
[ { "name":"31 Street Broadway Hotel", "price":"$59", "rating":"2.5", "link":"https://www.google.com/travel/search?q=New%20York&qs=MihDaG9JeFBLSXpvWDR6SWZMQVJvTkwyY3ZNVEZ3ZDJnMU4yYzFOUkFCOAA¤cy=USD&ved=2ahUKEwiY1rucg9CMAxUIAPkAHXyaE5EQyvcEegQIAxA-&ap=KigKEgm4tF8JXhxEQBF5jsg3iI5SwBISCfZ7hYTLm0RAEXmOyLfKcVLA&ts=CAESCgoCCAMKAggDEAAaXAo-EjwKCS9tLzAyXzI4NjIlMHg4OWMyNGZhNWQzM2YwODNiOjB4YzgwYjhmMDZlMTc3ZmU2MjoITmV3IFlvcmsSGhIUCgcI6Q8QBBgQEgcI6Q8QBBgRGAEyAhAAKgcKBToDVVNE" }, { "name":"The One Boutique Hotel", "price":"$90", "rating":"3.3", "link":"https://www.google.com/travel/search?q=New%20York&qs=MidDaGtJZ0t6dDBjdkZ6dG1jQVJvTUwyY3ZNWEUxWW14eWF6a3pFQUU4AA¤cy=USD&ved=2ahUKEwiY1rucg9CMAxUIAPkAHXyaE5EQyvcEegQIAxBV&ap=KigKEgm4tF8JXhxEQBF5jsg3iI5SwBISCfZ7hYTLm0RAEXmOyLfKcVLA&ts=CAESCgoCCAMKAggDEAAaXAo-EjwKCS9tLzAyXzI4NjIlMHg4OWMyNGZhNWQzM2YwODNiOjB4YzgwYjhmMDZlMTc3ZmU2MjoITmV3IFlvcmsSGhIUCgcI6Q8QBBgQEgcI6Q8QBBgRGAEyAhAAKgcKBToDVVNE" }, { "name":"Ly New York Hotel", "price":"$153", "rating":"4.4", "link":"https://www.google.com/travel/search?q=New%20York&qs=MihDaG9JbU9UeXpldUN6cnlrQVJvTkwyY3ZNVEYyY0d3MGJuSXpZaEFCOAA¤cy=USD&ved=2ahUKEwiY1rucg9CMAxUIAPkAHXyaE5EQyvcEegQIAxBu&ap=KigKEgm4tF8JXhxEQBF5jsg3iI5SwBISCfZ7hYTLm0RAEXmOyLfKcVLA&ts=CAESCgoCCAMKAggDEAAaXAo-EjwKCS9tLzAyXzI4NjIlMHg4OWMyNGZhNWQzM2YwODNiOjB4YzgwYjhmMDZlMTc3ZmU2MjoITmV3IFlvcmsSGhIUCgcI6Q8QBBgQEgcI6Q8QBBgRGAEyAhAAKgcKBToDVVNE" }, { "name":"King Hotel Brooklyn Sunset Park", "price":"$75", "rating":"3.4", "link":"https://www.google.com/travel/search?q=New%20York&qs=MihDaG9JbllMLW1iTG5uLTNDQVJvTkwyY3ZNVEZ5ZDNKNWQyUXdiQkFCOAA¤cy=USD&ved=2ahUKEwiY1rucg9CMAxUIAPkAHXyaE5EQyvcEegUIAxCJAQ&ap=KigKEgm4tF8JXhxEQBF5jsg3iI5SwBISCfZ7hYTLm0RAEXmOyLfKcVLA&ts=CAESCgoCCAMKAggDEAAaXAo-EjwKCS9tLzAyXzI4NjIlMHg4OWMyNGZhNWQzM2YwODNiOjB4YzgwYjhmMDZlMTc3ZmU2MjoITmV3IFlvcmsSGhIUCgcI6Q8QBBgQEgcI6Q8QBBgRGAEyAhAAKgcKBToDVVNE" }, { "name":"Aman New York", "price":"$2,200", "rating":"4.4", "link":"https://www.google.com/travel/search?q=New%20York&qs=MidDaGtJc3Q3dF80YmhzWW9ZR2cwdlp5OHhNV1kyTW1Sd2VIbHNFQUU4AA¤cy=USD&ved=2ahUKEwiY1rucg9CMAxUIAPkAHXyaE5EQyvcEegUIAxCiAQ&ap=KigKEgm4tF8JXhxEQBF5jsg3iI5SwBISCfZ7hYTLm0RAEXmOyLfKcVLA&ts=CAESCgoCCAMKAggDEAAaXAo-EjwKCS9tLzAyXzI4NjIlMHg4OWMyNGZhNWQzM2YwODNiOjB4YzgwYjhmMDZlMTc3ZmU2MjoITmV3IFlvcmsSGhIUCgcI6Q8QBBgQEgcI6Q8QBBgRGAEyAhAAKgcKBToDVVNE" }, .... more ]
Now that we’ve scraped hotel listings from search results, the next step is to extract details from individual hotel pages.
Extracting Individual Hotel Details
Once we have a list of hotel links from the search results, we can visit each hotel’s page to extract more information, like the full address, phone number, and additional hotel features. This gives us a deeper understanding of the property and is useful for competitor analysis, price tracking, or building travel apps.
🔍 Inspecting the HTML for Hotel Details
Open a hotel link in your browser and use your browser’s Inspect tool to find selectors for important fields:
Hotel Name: Found in an <h1> tag with class FNkAEc.
Price: Located in a <span> tag with classes qQOQpe prxS3d.
Rating: Extracted from a <span> with classes KFi5wf lA0BZ.
Number of Reviews: Found in a <span> with classes jdzyld XLC8M, next to the rating.
Hotel Type: Found in a <span> with class CFH2De.
Address & Contact: Located inside a div with class K4nuhf, where:
spans[0] gives the address
spans[2] gives the contact info
Note: These selectors may change based on location and layout. Always verify them in your own browser before scraping.
🧰 Writing the Details Scraper
Using the identified CSS selectors, let’s create a Google Hotel Details Scraper using BeautifulSoup.
defmain(): # Example input list from listings scraper hotel_links = [ "https://www.google.com/travel/search?q=New%20York&qs=MihDaG9JeFBLSXpvWDR6SWZMQVJvTkwyY3ZNVEZ3ZDJnMU4yYzFOUkFCOAA¤cy=USD&ved=2ahUKEwiY1rucg9CMAxUIAPkAHXyaE5EQyvcEegQIAxA-&ap=KigKEgm4tF8JXhxEQBF5jsg3iI5SwBISCfZ7hYTLm0RAEXmOyLfKcVLA&ts=CAESCgoCCAMKAggDEAAaXAo-EjwKCS9tLzAyXzI4NjIlMHg4OWMyNGZhNWQzM2YwODNiOjB4YzgwYjhmMDZlMTc3ZmU2MjoITmV3IFlvcmsSGhIUCgcI6Q8QBBgQEgcI6Q8QBBgRGAEyAhAAKgcKBToDVVNE", "https://www.google.com/travel/search?q=New%20York&qs=MidDaGtJZ0t6dDBjdkZ6dG1jQVJvTUwyY3ZNWEUxWW14eWF6a3pFQUU4AA¤cy=USD&ved=2ahUKEwiY1rucg9CMAxUIAPkAHXyaE5EQyvcEegQIAxBV&ap=KigKEgm4tF8JXhxEQBF5jsg3iI5SwBISCfZ7hYTLm0RAEXmOyLfKcVLA&ts=CAESCgoCCAMKAggDEAAaXAo-EjwKCS9tLzAyXzI4NjIlMHg4OWMyNGZhNWQzM2YwODNiOjB4YzgwYjhmMDZlMTc3ZmU2MjoITmV3IFlvcmsSGhIUCgcI6Q8QBBgQEgcI6Q8QBBgRGAEyAhAAKgcKBToDVVNE" ]
detailed_hotels = []
for url in hotel_links: data = parse_hotel_details(url) if data: detailed_hotels.append(data)
save_detailed_data(detailed_hotels) print(f"Saved details of {len(detailed_hotels)} hotels to google_hotel_details.json")
[ { "name": "31 Street Broadway Hotel", "price": "$59", "rating": "3.8", "no_of_reviews": " (461)", "hotel_type": "2-star hotel", "address": "38 W 31st St #110, New York, NY 10001", "contact": "(516) 770-8751", "link": "https://www.google.com/travel/search?q=New%20York&qs=MihDaG9JeFBLSXpvWDR6SWZMQVJvTkwyY3ZNVEZ3ZDJnMU4yYzFOUkFCOAA¤cy=USD&ved=2ahUKEwiY1rucg9CMAxUIAPkAHXyaE5EQyvcEegQIAxA-&ap=KigKEgm4tF8JXhxEQBF5jsg3iI5SwBISCfZ7hYTLm0RAEXmOyLfKcVLA&ts=CAESCgoCCAMKAggDEAAaXAo-EjwKCS9tLzAyXzI4NjIlMHg4OWMyNGZhNWQzM2YwODNiOjB4YzgwYjhmMDZlMTc3ZmU2MjoITmV3IFlvcmsSGhIUCgcI6Q8QBBgQEgcI6Q8QBBgRGAEyAhAAKgcKBToDVVNE" }, { "name": "The One Boutique Hotel", "price": "$90", "rating": "4.5", "no_of_reviews": " (1.2K)", "hotel_type": "3-star hotel", "address": "137-72 Northern Blvd, Flushing, NY 11354", "contact": "(718) 886-3555", "link": "https://www.google.com/travel/search?q=New%20York&qs=MidDaGtJZ0t6dDBjdkZ6dG1jQVJvTUwyY3ZNWEUxWW14eWF6a3pFQUU4AA¤cy=USD&ved=2ahUKEwiY1rucg9CMAxUIAPkAHXyaE5EQyvcEegQIAxBV&ap=KigKEgm4tF8JXhxEQBF5jsg3iI5SwBISCfZ7hYTLm0RAEXmOyLfKcVLA&ts=CAESCgoCCAMKAggDEAAaXAo-EjwKCS9tLzAyXzI4NjIlMHg4OWMyNGZhNWQzM2YwODNiOjB4YzgwYjhmMDZlMTc3ZmU2MjoITmV3IFlvcmsSGhIUCgcI6Q8QBBgQEgcI6Q8QBBgRGAEyAhAAKgcKBToDVVNE" } ]
Final Thoughts
Scraping Google Hotels helps you collect valuable data like hotel names, prices, reviews, ratings, addresses, and contact info. This data is valuable for travel research, building hotel comparison tools, or monitoring market trends.
Using the Crawlbase Crawling API makes it easier to scrape dynamic content while avoiding blocks or CAPTCHAs. Combined with BeautifulSoup for parsing and JSON for saving data, you can build a simple yet powerful scraper in Python.
As you scrape hotel data, always follow ethical and legal best practices to keep your projects safe and compliant.
Looking to scrape more platforms? Check out our other scraping guides:
If you have questions, ideas or need help, our team is here for you. Thanks for reading, and happy scraping!
Frequently Asked Questions
Q. Is it legal to scrape Google Hotels data?
Scraping public data from websites like Google Hotels can be legal if done ethically and within the website’s terms of service. Always avoid scraping personal data, and make sure you comply with local data privacy laws and scraping regulations.
Q. Why use the Crawlbase Crawling API for scraping Google Hotels?
Google Hotels’ content is loaded dynamically using JavaScript, which can be hard to scrape with regular tools. The Crawlbase Crawling API loads full HTML like a real browser and handles JavaScript, Pagination, CAPTCHAs, and IP rotation—making your scraping faster, easier, and more reliable.
Q. What data can I extract from Google Hotels?
You can extract the hotel name, price, address, rating, number of reviews, hotel type, and contact details. This information is useful for hotel analytics, price monitoring, market research, and travel-related apps.