For the complete documentation index, see llms.txt. This page is also available as Markdown.

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.

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

Parameter
Description
Default Value

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)

–

render

Enables JavaScript rendering when set to html. More info.

–

parse

Returns parsed data when set to true. See more in output dictionary.

false

callback_url

URL to your callback endpoint. More info.

–

user_agent_type

Device type and browser. The full list can be found here.

desktop

- mandatory parameter

Localization

Adapt search results to specific geographical locations and languages.

Parameter
Description
Default Value

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.

-

NOTE: "geo_location": "United States" and other wide-area locations are not supported. Use city-level geo_location, e.g., Seattle,Washington,United States

Pagination

Parameter
Description
Default Value

start_page

Starting page number.

1

Filtering

Advanced options for tailoring and refining the search context.

Parameter
Description
Default Value

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.

Structured google_travel_hotels output (JSON)

Output dictionary

The table below presents a detailed list of each top-level element we parse, along with its description and data type.

The number of offers and certain fields may vary depending on the search query and property.

Key
Description
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

parse_status_code

The status code of the parsing job. Learn more here.

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

status_code

Status code of the scraping job. Learn more here.

integer

Last updated

Was this helpful?