# Google Hotels Scraper - destination search (`t2solutions/google-hotels-scraper`) Actor

Reliable Google Hotels data as clean JSON: names, ratings, total prices, deals, booking links. Plain HTTP, honest run summaries. Google Flights companion.

- **URL**: https://apify.com/t2solutions/google-hotels-scraper.md
- **Developed by:** [T2 Solutions](https://apify.com/t2solutions) (community)
- **Categories:** Travel, Automation, Agents
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 1,000 hotel rows

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Google Hotels Scraper — destination search

Fetch real hotel search results from **Google Hotels** for a destination and stay:
name, address, coordinates, star class, guest rating with review count, total price
with currency, booking link, deal badge and description — as clean JSON, one row per
hotel, ready for Sheets, databases or an agent pipeline.

No headless browser. No login. No proxies. One paced plain-HTTP request per search,
exactly like a human tab — because that is what works: Google serves the full hotel
data server-rendered in the results page, and this actor parses it with a
fixture-pinned, test-verified layout contract (20/20 golden-fixture rows match the
Stage-2 field map).

### Why use this actor

- 🎯 **The price Google shows** — the total a shopper sees, not an inferred estimate. Plus coordinates, ratings, reviews, deals and the booking link.
- ⚡ **Plain HTTP, no browser spin-up** — no headless browser, no proxy pool, no login: one GET per search (plus at most one retry when Google misreads an ambiguous destination), paced 25 s (floor 10 s), with 30/120/300 s backoff on a rate limit. (Every 2026 tutorial we read for this niche assumes proxy rotation + CAPTCHA; our own spikes on 2026-11-10 needed neither — 26 bounded candidate requests, zero 429s, zero walls.)
- 🧾 **It reports its own honesty** — every run ends with exactly one `RUN_SUMMARY` row (`complete` / `partial` / `timed_out` / `zero_match`), so an empty result set never masquerades as a success.
- 🧮 **Batch input** — search several destinations in one run with a shared fail-safe deadline (default 55 min).
- 🤖 **Agent-ready** — deterministic parsing (the same saved page parsed twice yields the same rows in the same order, differing only in `fetchedAt`), `LIMITED_PERMISSIONS`-compatible, and an MCP section below: an agent can drive it unattended. Live Google varies what it serves between fetches — [Stay dates & run-to-run variability](#stay-dates--run-to-run-variability) spells out exactly what that means for diffing runs.
- 🛡️ **Fail-safe deadline** — never hangs past a wall you set; partial results are flushed and honestly labeled instead of vanishing.

### Input

| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `jobs` | array of objects (required) | — | One or more search jobs (see below), 1..100. |
| `failSafeDeadlineMinutes` | integer | `55` | Hard wall for the whole run (below the platform timeout). On expiry running stops, fetched rows are kept, and `RUN_SUMMARY` records `timed_out`/`partial`. A value ≤ 0 means "deadline already reached" (fail-fast). |

**In the Apify Console the input is a form:** each job renders as its own group of
fields — destination text field, check-in/check-out date pickers, guests, rooms, max
hotels and the enrichment checkbox — with add/remove controls for batch runs. No
JSON editing is needed. API and MCP callers send the same `jobs` array shown below.

There are **no proxy, token or credential fields** — egress is resolved by the house
`egress_pool` module from the platform environment (EGRESS-STANDARD), and
`hl=en`/`gl=US`/`currency=USD` are pinned by the actor, not taken from input.

#### Job object (search type)

| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `type` | string | `"search"` | Only `search` is supported in v1. |
| `destination` | string (required) | — | City or region query as you would type it into Google Hotels, e.g. `Paris`, `New York`, `Ho Chi Minh City`. Include the qualifier for ambiguous names (`ho chi minh` alone can resolve to the person). |
| `checkIn` / `checkOut` | date (optional) | unset | ISO dates (`YYYY-MM-DD`) recorded as input intent and passed to Google in the URL. Google's server-rendered results currently **do not apply URL dates** (verified 2026-11-11 across 10+ URL variants — see [Stay dates & run-to-run variability](#stay-dates--run-to-run-variability)): Google serves its own default stay, rows always carry the **displayed** stay, `staySpecified` records that you asked for one, and `nights` lets you detect the mismatch against your request. |
| `guests` | integer | `2` | 1..16 (out-of-range values are clamped). |
| `rooms` | integer | `1` | 1..8 (out-of-range values are clamped). |
| `maxHotels` | integer | `100` | Per-job cap on hotel rows (1..5000); the actor-level cap is 5000 rows per run. One search = **one results page, no pagination**: the live e2e of 2026-11-11 delivered **18–20 rows per destination at `maxHotels: 100`**, so a job yields what Google's page serves — `maxHotels` caps that yield, it does not fetch extra pages. |
| `enrichDetails` | boolean | `false` | CAP-5 opt-in for detail-page enrichment (address, amenities, review detail, provider prices) — see [Enrichment](#enrichment-cap-5-) below. |

**`jobLabel` is derived, not an input field:** every row carries
`"{1-based raw-input index}:{destination}"` — e.g. job 1 with destination `Paris`
labels its rows `1:Paris`. It is unique per job, stable within a run, and is half of
the row identity (`hotelId` + `jobLabel`).

**Ambiguous destination fallback:** if Google serves a non-hotel entity page for a
bare name (live case: `ho chi minh` resolves to the person, not the city), the actor
retries **once** with `hotels in <destination>`. Delivered rows keep your original
`destination` and `jobLabel`; `RUN_SUMMARY.jobResults[].queryFallback: true` records
that the retry happened. Write the city form up front (`Ho Chi Minh City`) and the
retry is never needed.

**API example input** — two destinations in one run:

```json
{
  "jobs": [
    { "type": "search", "destination": "Paris",
      "checkIn": "2026-11-20", "checkOut": "2026-11-23",
      "guests": 2, "rooms": 1, "maxHotels": 100,
      "enrichDetails": false },
    { "type": "search", "destination": "Tokyo",
      "checkIn": "2026-12-01", "checkOut": "2026-12-05" }
  ],
  "failSafeDeadlineMinutes": 55
}
```

### Output

One row per hotel (23 columns), then **exactly one** final `RUN_SUMMARY` row.

| Column | Nullable | Notes |
|--------|----------|-------|
| `hotelId` | no | Google entity id from the payload — dedupe key (with `jobLabel`). |
| `jobLabel` | no | Derived `"{index}:{destination}"` — which input job produced this row. |
| `destination` | no | Destination as requested. |
| `name` | no | Hotel name as displayed. |
| `address` | yes | **Detail-page only** (results records carry none) — null; documented reason `detail_not_fetched` until a detail fetch fills it. |
| `lat` / `lng` | no | WGS84 from the payload (20/20 in the fixture). |
| `starRating` | yes | Class string (`"4-star tourist hotel"`) — genuinely absent for some hotels (7/20 in fixture). |
| `guestRating` | yes | Score from the `[score, reviewCount]` tuple; null for unrated hotels. |
| `reviewCount` | yes | Same tuple; null when Google shows no count. |
| `staySpecified` | no | Whether the **input** specified dates (Google defaults a stay regardless). |
| `nights` | no | As displayed by Google (a defaulted stay counts). |
| `priceTotal` | yes | Total as displayed; null → `availabilityNote` (e.g. `no_rates_on_page`). Never invented. |
| `pricePerNight` | yes | **Results pages carry totals only** (fixture: 40 totals, 0 per-night) — null; documented reason `not_displayed`. |
| `currency` | no | **Read from the payload** (one currency per run); the actor requests `USD` and reports what arrives (payload-actual is the contract). |
| `availabilityNote` | yes | Free-text reason when no rate is displayed. |
| `bookingUrl` | yes | Google Hotels hotel page (`https://www.google.com/travel/hotels/entity/{hotelId}`) with live provider prices and booking buttons — opens outside the run. The results payload's `/travel/clk/…` path is a **204 tracking endpoint**, so it is not shipped. |
| `dealBadge` | yes | e.g. `"24% less than usual"` when Google shows a deal. |
| `description` | yes | Hotel description from the payload when present. |
| `amenities[]` | yes | Enrichment only; null until `enrichDetails` is on **and** reachable. |
| `reviewDetail` | yes | Enrichment only: a dict of Google's review-block labels (live keys: `Accessibility`, `Bar or lounge`, `Cleanliness`, …) each mapping to `{sentiment, mentions}`; null with documented reason otherwise. |
| `detailPrice` | yes | Enrichment only (provider price entries); each entry carries its own working `bookingUrl` (Google's `/travel/lodging/clk` redirect to the provider). Null with documented reason otherwise. |
| `fetchedAt` | no | ISO timestamp — the **only** non-deterministic field (CAP-3). |

#### RUN_SUMMARY (the honesty row)

| Field | Meaning |
|---|---|
| `state` | `complete` · `partial` (some jobs failed or input was dropped) · `timed_out` (deadline wall) · `zero_match` (every job fetched fine but Google returned no hotels) |
| `rowsRequested` / `rowsFetched` | Capped demand vs what was delivered. |
| `jobsTotal` / `jobsOk` / `jobsFailed` | Per-job counts. |
| `partialReason` | `jobs_missing` · `no_valid_jobs` · `fatal_input` · `input_invalid` · `job_cap` · `row_cap` · `deadline` · `rate_limited` · `http_error` · `timeout` · `parse_failure` · `egress_unavailable` · `invalid_job` · `unknown` · `job_failure` |
| `detailUnavailable` | Job labels where `enrichDetails` was requested but not delivered, with reason: `cap5_probe_not_passed` (activation gate) or `detail_fetch_failed`. |
| `issues` | Counts of records the parser refused: `schema_mismatch` · `short_record` · `skipped_no_identity` · `missing_required`. |
| `jobResults` | Per-job outcome — label, `status` (`ok`/`failed`), `rows`, plus `records` / `issues` / `truncatedRecords` / `detailFailures` / `queryFallback` when present and a `reason` on failure. This is the field that says **which job and why**. |
| `inputNotes` | Why requested jobs were skipped before the loop (unsupported type, missing destination, beyond the job cap); null when every job was accepted. |
| `runStartedAt` / `runFinishedAt` | ISO timestamps for the run's start and this summary's write. |
| `egress*` | Counts-only telemetry merged from `egress_pool` (`mode`, lanes, rotations, failures, degraded flag) — merged into this row and nowhere else. |

**Zero-match example** (a real empty run — an agent should read this, not panic):

```json
{
  "recordType": "RUN_SUMMARY",
  "state": "zero_match",
  "rowsRequested": 100,
  "rowsFetched": 0,
  "jobsTotal": 1,
  "jobsOk": 1,
  "jobsFailed": 0,
  "partialReason": null,
  "detailUnavailable": null,
  "issues": null
}
```

Charging matches this row: you pay per hotel row (`result` event); a zero-match run
charges **zero** results. The `RUN_SUMMARY` row itself never charges.

### Enrichment (CAP-5) 🅿️

`enrichDetails` is **off by default** (opt-in per job). The activation gate — a
single bounded detail-page probe approved at the step-02 gate — **PASSED on
2026-11-11**: the live Paris Marriott Champs Élysées detail page yielded its
address, 24 amenities, review subscores and 26 provider prices (evidence
`_bmad-output/cap5-probe-verify-2026-11-11.json`), so `enrichDetails: true`
performs detail fetches:

- With the gate active, `address`, `amenities`, `reviewDetail` and `detailPrice`
  fill from the detail page. Should the gate ever be inactive, those columns are
  **honest nulls** — never invented — and `RUN_SUMMARY.detailUnavailable` says
  why (`cap5_probe_not_passed`).
- When enrichment is requested but a detail fetch fails, the row keeps its nulls and the summary records `detail_fetch_failed`.
- Results-page columns are complete without it: identity, coordinates, ratings, stay, total price, currency, booking link and deal badge all come from the search page itself.
- ⏱️ **Pacing cost when opted in:** detail fetches are spaced `DETAIL_PACING_SECONDS`
  (25 s) apart, so `enrichDetails: true` with `maxHotels: 100` needs ≈ 42 min for ONE
  job (100 × 25 s plus the search) — a multi-job opted-in run therefore
  **deterministically ends `timed_out`** against the 55-min `failSafeDeadlineMinutes`
  default, and every detail fetch is billed compute. In money terms each enriched row
  adds ≈ **$0.0008** of platform compute at 512 MB (25 s pacing + the measured
  $0.000095 detail fetch of 2026-11-11) — which is what sets the price point in
  [Pricing](#pricing). Mitigations: lower `maxHotels`
  per job, or raise `failSafeDeadlineMinutes` (max 59).

### Use with AI agents (MCP)

Every Apify actor is callable by AI agents — this one is built to behave when they drive it:

- **Apify MCP server** — add `https://mcp.apify.com` as an MCP server in your agent (Claude, Cursor, etc.), authenticate with an Apify API token, and this actor appears as a tool whose input is the plain JSON schema above.

- **REST** — one call starts a run, one call reads the results:

  ```bash
  curl -X POST "https://api.apify.com/v2/acts/YOUR~google-hotels-scraper/runs?token=YOUR_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{"jobs":[{"destination":"Paris","checkIn":"2026-11-20","checkOut":"2026-11-23"}]}'
  # results: GET /v2/acts/YOUR~google-hotels-scraper/runs/{runId}/dataset/items?token=YOUR_TOKEN
  ```

- **Safe to hand over** — the actor runs under Apify's `LIMITED_PERMISSIONS`: a run can only do what a run needs (its own dataset and key-value store, plus the Google Hotels page it fetches), nothing else in your account.

- **It reports its own honesty** — the `RUN_SUMMARY` row means an agent can tell a complete scan from a timed-out, rate-limited, invalid-input or zero-match one without guessing from an empty dataset.

- **Batch input** — `"jobs": [ {...}, {...} ]` resolves several destinations in one call, which is how agents usually want to use it.

- **Deterministic parsing** — the same saved page parsed twice → byte-identical rows (only `fetchedAt` differs), so the actor never reshuffles or invents data. Across live runs, diff on `hotelId` and check `nights` first: Google varies the served list, order, default stay and prices between fetches ([details](#stay-dates--run-to-run-variability)).

### Migrating from another Google Hotels scraper?

An honest comparison — including where another tool may still be right. (Figures are what the respective Store pages showed in our Store recon of **2026-11-10**; verify live stats yourself.)

| If you're on | What changes |
|---|---|
| **zerobreak/google-hotels-scraper** (top by users, 5.00★) | Strong actor, but our 2026-11-10 recon snapshot showed **22.4% of its runs failing** (4,169 failed runs/30d) — and it charges $0.00499/hotel row. This actor's wedge is reliability plus agent-readiness: every run ends in a `RUN_SUMMARY` state that says what actually happened. |
| **vittuhy** ($0.001/row) | A low per-row price — if absolute cost per row is all you need, it's a fair pick. You trade away the honesty contract and the fixture-verified parsing guarantees this actor documents precisely. |
| **factden** / **kestrel** ($0.004/hotel) | Charged per hotel row at $0.004; `kestrel` is new (entered 2026-11-06), so watch it. This actor answers with the same per-row model plus the sibling's `RUN_SUMMARY` contract. |

**Not the right tool if:** you need live availability across OTA providers, room-type
breakdowns, or a price calendar — Google's results-page payload doesn't publish them
per hotel and we won't invent them (per-night prices are honestly null — documented
reason `not_displayed`; provider prices arrive only via enrichment).

### Pricing

Pay-per-event: you pay per hotel row delivered, and a zero-match run charges zero results.

> **Price (live on the Store since publish, 2026-11-12):** **`result` @ $0.003 per
> hotel row** — the Store shows *from $3.00 / 1,000 hotel rows*. It cleared the house
> ≥50% net-margin guardrail at the measured cost of both run shapes (approved by the
> developer 2026-11-12). The field reference from our recon: **zerobreak $0.00499**,
> **vittuhy $0.001**, **factden $0.004**, **kestrel $0.004** per hotel row (field
> majority 4/6 rivals charge per row). Plus the platform-standard **`apify-actor-start`**
> event at **$0.00005 per run**, which covers the first 5 seconds of compute and is
> charged by Apify automatically, independent of results.

Charging mechanics (already shipped and test-pinned): **one `result` per hotel row**
in the RESULT dataset; the `RUN_SUMMARY` row never charges; zero rows → zero charge
events. Platform usage (compute) is billed separately under Apify's usage pricing.

**The price: `result` @ $0.003 per hotel row** (set live at publish, 2026-11-12).
Anchored to the field reference above
(Store recon 2026-11-10): the **field median ≈ $0.003 per hotel**, **1.7× under zerobreak's
$0.00499**, cheaper than factden/kestrel at $0.004 — and the price at which both run
shapes (results-only and `enrichDetails: true`) clear the guardrail.

Why that price — measured inputs (Stage-3 evidence, 2026-11-11;
`_bmad-output/e2e-live-gh-*-results-2026-11-11.json` + `_bmad-output/e2e-live-gh-verify-2026-11-11.json`):

| Input | Measured |
|---|---|
| Platform cost of one results-page fetch (n=6) | **$0.000089–$0.000608** (median $0.000095) |
| Hotel rows one search page delivers | **18–20** (20/20/18 at `maxHotels: 100`) |
| Platform cost per hotel row, results-only | ≈ **$0.000005–$0.000034** (fetch cost ÷ rows) |
| Platform cost per enriched row (`enrichDetails: true`) | ≈ **$0.0008** — 25 s detail pacing at 512 MB plus the measured $0.000095 fetch |

| Run shape | Rows | Event revenue | After Apify's 20% | Platform usage (model, 512 MB) | Net margin |
|---|---|---|---|---|---|
| 1 destination, results-only | 15–20 | $0.045–0.060 | $0.036–0.048 | ≈ $0.0011 | **≈ 97%** ✅ |
| 1 destination + `enrichDetails: true` (≈7 min) | 15 | $0.045 | $0.036 | ≈ $0.013 | **≈ 64%** ✅ |
| 3 destinations (batch), results-only | ~58 | $0.174 | $0.139 | ≈ $0.0031 | **≈ 98%** ✅ |
| zero-match run | 0 | $0 | $0 | ≈ $0.0006–0.001 | bounded loss — honest $0 revenue |

Guardrail clears from **1 row** results-only and **≈3 rows** with enrichment. Usage above
the measured line is a **model** from Apify's published rates ($0.20/CU; 1 CU = 1 GB × 1 h)
plus the measured fetch costs, at the **512 MB** memory this actor is deployed with
(the platform's 4096 MB default pushes an enriched run below the line). First platform
runs (2026-11-12, both tasks SUCCEEDED): **$0.0203** for a 15-row enriched demo and
**$0.0038** for a 60-row 3-destination batch — the week-1 Console billing audit
(≈2026-11-19) re-checks these against the actual billing tab.

### Stay dates & run-to-run variability

Two platform facts, verified from the build vantage on 2026-11-11 and worth knowing
before you diff runs (evidence: `_bmad-output/e2e-paris-date-control-2026-11-11.json`,
`_bmad-output/e2e-paris-repeat-determinism-2026-11-11.json`):

1. **URL dates don't reach Google's served results.** Ten-plus URL forms (query,
   path, `/travel/search`, legacy `date1/date2`, full browser headers, warm
   sessions, natural-language queries, two egresses) all returned Google's own
   default stay, and the page's own data request (`AF_dataServiceRequests`) carries
   no dates — the ISO dates you pass are echoed only into the links Google
   generates. The actor still sends `checkIn`/`checkOut`/`guests`/`rooms` and
   honestly reports what came back: the **displayed** stay (`nights`) with
   `staySpecified` recording your input.
2. **Identical queries are not repeat-stable live.** Two byte-identical fetches an
   hour apart from Apify egress shared only 10 of 20 hotels, differed in row order,
   had 0/10 identical prices, and Google's default stay had rotated (Nov 12→13
   became Nov 13→14) — so a cross-run price delta mixes stay-window change with
   market movement. Determinism this actor guarantees is at the **parsing layer**:
   the same saved page always yields the same rows. When you diff live runs: match
   on `hotelId`, confirm `nights` is unchanged, and treat a changed row set as
   Google's slice, not your query.

### FAQ

**How fresh are the prices?** As fresh as a search: one paced GET per job at run time.
Prices are Google's own snapshot from your run's moment, not a cached feed. Read a
cross-run price delta with care: Google may have served a different slice or a
different default stay that day — check `nights` and the row set first
([details](#stay-dates--run-to-run-variability)).

**Does this hit rate limits?** Pacing defaults to 25 s between searches (hard floor
10 s) with 30/120/300 s backoff on a rate limit — the posture our stage-2 spike
verified 20/20 clean at 25 s over 23 minutes with zero 429s. A rate-limited job is
retried, then recorded as `partialReason: rate_limited`, never silently dropped.

**What about the stay dates?** Set `checkIn`/`checkOut` to record your intent and keep
it in the URL — but Google's server-rendered results **currently ignore URL dates**
(verified 2026-11-11 across 10+ URL variants on two egresses; the page's own data
request carries no dates): Google serves its own default stay. Either way the row
carries the **displayed** stay — `nights` is what Google shows, `staySpecified` says
whether the input asked for it. Compare your requested nights against `nights`; if
they differ, Google priced its default window, not yours.

**Can I get per-night prices or the price calendar?** Not from the results page —
Google shows totals there, so `pricePerNight` is honestly null; documented reason
`not_displayed`. Provider-level prices arrive only through enrichment (`detailPrice`).

**Can I localize?** The query pins `hl=en&gl=US&currency=USD` (defaults); the currency
**column** reports what the payload actually returns (payload-actual is the contract).
Non-USD/localized output is on the roadmap.

**Something failed mid-run.** Read `RUN_SUMMARY`: `jobResults` tells you which job
failed and why (per-label `reason`), while `partialReason`, the `issues` counters and
the `egress*` telemetry give the run-level picture. Partial runs keep the rows that
succeeded.

**Egress — where does traffic leave from?** The house `egress_pool` module (vendored,
see below) resolves egress once per run from the platform environment: direct/datacenter
by default at **$0**, residential pools explicitly **forbidden**. If egress is
unusable, no HTTP is attempted and every job fails closed with `egress_unavailable`
— recorded in `RUN_SUMMARY`, never hidden.

### Egress provenance (EGRESS-STANDARD)

Traffic runs through the house **`egress_pool`** module, vendored byte-identical from
the `egress_pool_apify` repository (v0.1.0, commit `a8358fec…`, 2026-11-09) —
provenance and file hashes in `egress_pool/VENDORED.md`. All HTTP goes through
`EgressSession`; telemetry (`TELEMETRY_KEYS`) merges only into the `RUN_SUMMARY` row.
The Docker image ships it via `COPY . ./`.

### Development (this repo)

```bash
## one-time: the golden fixtures are gitignored — copy them from the
## apify-business archive BEFORE running the tests (they fail at import
## without them):
copy ..\apify-business\scripts\_bmad-output\bodies\r3-gh1-results.html _bmad-output\fixture-gh-results-paris.html
copy ..\apify-business\scripts\_bmad-output\bodies\r3-gh3-detail.html _bmad-output\fixture-gh-detail-paris.html

python -m py_compile main.py fetcher.py telemetry.py   # syntax gate
python test_fetcher.py        # 57 tests — fixture-pinned layout contract + transport
python test_main_wiring.py    # 43 tests — run orchestration with a fake SDK

## local run reads INPUT.json from cwd — copy the shipped example first:
copy .actor\INPUT.json INPUT.json
python -m main
```

All tests run **offline** against the archived golden fixtures — no network, no
spend. Fixtures (gitignored): `_bmad-output/fixture-gh-results-paris.html` (20-row
results page) and `_bmad-output/fixture-gh-detail-paris.html` (detail page), pinned
by the Stage-2 field-map oracles (`field-map-gh-extraction-2026-11-10.json`,
`field-map-gh-detail-verify-2026-11-10.json`).

Design/parity docs: spec and companions in `_bmad-output/specs/spec-google-hotels-scraper/`
(`SPEC.md`, `input-output.md`, `field-map.md`), build spec in
`_bmad-output/implementation-artifacts/spec-16-google-hotels-stage3.md`.

### Related actors

Same developer, adjacent surfaces — all three share the `RUN_SUMMARY` completeness
contract, `LIMITED_PERMISSIONS`, and pay-per-result pricing, so an agent that drives
one can drive the others without new glue:

- **[Google Flights Price Fetcher](https://apify.com/t2solutions/google-flights-price-fetcher)** — the shipped sibling (this actor's codebase twin): route & date flight offers with segment detail and the price Google shows.
- **[Google Ads Transparency Scraper](https://apify.com/t2solutions/google-ads-transparency-scraper)** — the ad-intel cluster's hero: search competitor ads by keyword, domain or advertiser id, with real landing pages (OCR included) across ~46 markets.
- **[TikTok Creative Center Ads Fetch](https://apify.com/t2solutions/tiktok-creative-center-ads-fetch)** — top TikTok ads by market & period.

If you're pricing a trip *and* watching what a travel brand advertises, the two compose: hotels for the stay, transparency for the campaign.

# Actor input Schema

## `jobs` (type: `array`):

Add one job per destination (1..100). Each job is one Google Hotels search; the actor fetches up to `maxHotels` rows for it and charges one `result` per delivered hotel row.

## `failSafeDeadlineMinutes` (type: `integer`):

Wall-clock deadline below the platform timeout. On expiry the actor flushes the rows already fetched, writes a RUN_SUMMARY with state `timed_out`/`partial`, and exits cleanly instead of being killed. A value ≤ 0 means the deadline is already reached (fail-fast, recorded as `timed_out`); values above 59 are clamped to 59.

## Actor input object example

```json
{
  "jobs": [
    {
      "destination": "Paris",
      "guests": 2,
      "rooms": 1,
      "maxHotels": 100,
      "enrichDetails": false
    }
  ],
  "failSafeDeadlineMinutes": 55
}
```

# Actor output Schema

## `hotels` (type: `string`):

Dataset of hotels (one row per hotel: identity, coordinates, ratings, stay, price, booking link) plus a final RUN_SUMMARY record.

## `summary` (type: `string`):

RUN_SUMMARY stored in the key-value store under key OUTPUT (state, row/job counts, partial reason, issues, detailUnavailable, egress telemetry).

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "jobs": [
        {
            "destination": "Paris",
            "guests": 2,
            "rooms": 1,
            "maxHotels": 100,
            "enrichDetails": false
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("t2solutions/google-hotels-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "jobs": [{
            "destination": "Paris",
            "guests": 2,
            "rooms": 1,
            "maxHotels": 100,
            "enrichDetails": False,
        }] }

# Run the Actor and wait for it to finish
run = client.actor("t2solutions/google-hotels-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "jobs": [
    {
      "destination": "Paris",
      "guests": 2,
      "rooms": 1,
      "maxHotels": 100,
      "enrichDetails": false
    }
  ]
}' |
apify call t2solutions/google-hotels-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,t2solutions/google-hotels-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/acdVZh16xxXnLb1kj/builds/qO5Afb6nfO6URecip/openapi.json
