Travel: Hotels
Scrape Google Travel: Hotels results with guest count, dates, and star rating filters. Flexible API integration with comprehensive parameter options.
The google_travel_hotels data source is designed to retrieve Google Travel service's hotel search results.
To ensure optimal utilization of this service, include the "render": "html" parameter in your request.
Request samples
In this example, we make a request to retrieve the 2nd results page for hotel availability for 2 adult guests between 2023-10-01 and 2023-10-10 for 2 to 4-star hotels in Paris from google.com.
curl 'https://realtime.oxylabs.io/v1/queries' \
--user 'USERNAME:PASSWORD' \
-H 'Content-Type: application/json' \
-d '{
"source": "google_travel_hotels",
"start_page": 2,
"query": "hotels in Paris",
"render": "html",
"parse": true,
"context": [
{"key": "adults", "value": 2},
{"key": "hotel_dates", "value": "2023-10-01,2023-10-10"},
{"key": "hotel_classes", "value": [2, 3, 4]}
]
}'import requests
from pprint import pprint
# Structure payload.
payload = {
"source": "google_travel_hotels",
"query": "hotels in Paris",
"start_page": 2,
"render": "html",
"parse": True,
"context": [
{
"key": "adults",
"value": 1
},
{
"key": "hotel_dates",
"value": "2023-10-01,2023-10-10"
},
{
"key": "hotel_classes",
"value": [2, 3, 4]
}
]
}
# Get response.
response = requests.request(
'POST',
'https://realtime.oxylabs.io/v1/queries',
auth=('USERNAME', 'PASSWORD'),
json=payload,
)
# Print prettified response to stdout.
pprint(response.json())We use synchronous Realtime integration method in our examples. If you would like to use Proxy Endpoint or asynchronous Push-Pull integration, refer to the integration methods section.
Request parameters
Generic
source
Sets the scraper. Use google_travel_hotels.
–
query
Search term for request. "query": "hotels" will return a list of hotels in a given geo_location.
"query": "hotels in <Location>" will return a list of hotels for <Location>. (e.g. "query": "hotels in Paris" will list hotels in Paris, regardless of geo_location)
–
- mandatory parameter
Localization
Adapt search results to specific geographical locations and languages.
geo_location
The geographical location that the result should be adapted for. Using this parameter correctly is extremely important to get the right data. Please note that this source can accept a limited number of geo_location values - please check this section to see geo_location values that don't yield accurate results.
-
locale
Accept-Language header value which changes your Google search page web interface language. More info.
-
Pagination
start_page
Starting page number.
1
Filtering
Advanced options for tailoring and refining the search context.
context:adults
Number of adult guests
2
context:children
Number of children guests
-
context:
hotel_classes
Filter results by # of hotel stars. You may specify one or more values between 2 and 5. Example: [3,4]
-
context:
hotel_dates
Dates for staying at the hotel, from - to. Example: 2023-07-12,2023-07-13
-
All context parameters should be used in the context array as objects with key and value pairs:
Structured data
Web Scraper API can extract results HTML or JSON response that contains structured data on various elements of the results page.
Output dictionary
The table below presents a detailed list of each top-level element we parse, along with its description and data type.
url
URL to the Google Travel hotel search page.
string
page
Current page number of the search results.
integer
last_visible_page
Maximum page number visible in the results page.
integer
results
Object containing the parsed hotel search results.
object
results.offers
List of hotel offers returned for the query. Includes pos, name, description, property_token, hotel_class, rating, deal, eco_certified, pricing, check_in_time, check_out_time, coordinates, amenities, images, nearby_places, website_url, details_url, reviews_url.
array
results.overview
General details about the search results. Includes country, language, total_results.
object
results.pagination
Details about the current page of results. Includes current_from, current_to.
object
created_at
Timestamp when the scraping job was created.
timestamp
updated_at
Timestamp when the scraping job was finished.
timestamp
job_id
ID of the job associated with the scraping job.
string
Last updated
Was this helpful?

