# Tripadvisor Hotels Scraper (`valiant_quarter/tripadvisor-hotels-scraper`) Actor

Tripadvisor hotel reviews (full text, language, trip type, sub-ratings, photos, owner response with date), hotel snapshots (rating, review histogram, popularity ranking, amenities) and area hotel search. Newest first, with a date floor for cheap incremental runs.

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

## Pricing

$3.00 / 1,000 results

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

## Tripadvisor Hotels Scraper

Three tools in one for [Tripadvisor](https://www.tripadvisor.com) hotels:

- **reviews** – every review of a hotel, newest first: full text, title, rating, language (and whether Tripadvisor machine-translated it), trip type, stay month, sub-ratings, photos, author, and the owner's response with its date.
- **place** – a snapshot of the hotel: rating, review count and histogram, popularity ranking ("#4 of 14 hotels in Sorgun"), class, amenities, address, coordinates, reviews per language, awards.
- **search** – the hotels of an area (by name such as "Kemer", or by Tripadvisor geo id) with rating, review count, class, ranking, address and coordinates.

Typical uses: reputation monitoring and owner-response tracking, competitor sets for a destination, ranking history, sentiment analysis.

### Input

```json
{
  "mode": "reviews",
  "startUrls": [{ "url": "https://www.tripadvisor.com/Hotel_Review-g1192102-d545626-Reviews-Lago_Hotel-Sorgun_Manavgat_Turkish_Mediterranean_Coast.html" }],
  "maxReviewsPerPlace": 100,
  "dateFrom": "30 days",
  "proxyConfiguration": { "useApifyProxy": true, "apifyProxyGroups": ["RESIDENTIAL"], "apifyProxyCountry": "DE" }
}
```

| Field | Default | Notes |
|---|---|---|
| `mode` | `reviews` | `reviews` / `place` / `search` |
| `startUrls` | — | Hotel pages (reviews and place modes). Any Tripadvisor domain works; the `-g<geo>-d<id>-` ids are what counts |
| `maxReviewsPerPlace` | `0` | Newest reviews first; `0` = all |
| `dateFrom` / `dateTo` | — | `YYYY-MM-DD`, full ISO date, or relative (`8 days`, `3 months`). Paging stops at `dateFrom`, so an incremental run costs one or two requests |
| `includePlaceInfo` | `true` | Adds a compact `placeInfo` block (name, rating, review count, histogram, address, coordinates) to every review |
| `queries` | — | Search mode: area names, e.g. `"Sorgun"`, `"Kemer"` |
| `geoIds` | — | Search mode: Tripadvisor geo ids, e.g. `[297966]` (the `g…` of a `/Hotels-g297966-…` page). Each geo is read until its own hotels run out (up to `scanPages`) |
| `hotelClass` | — | Search mode: use Tripadvisor's star filter (1-5) |
| `maxResults` / `scanPages` / `sortBy` / `includeNearby` | `30` / `4` / `reviews` / `false` | Search mode: hotels per query, list pages to read (30 hotels each), order (most reviewed first, or Tripadvisor's list order), include hotels of neighbouring areas |
| `proxyConfiguration` | Apify RESIDENTIAL, DE | See below |
| `maxRotations` | `10` | How often a hotel scan may switch to a fresh browser and IP after a block before it gives up |

### Output

**Reviews mode** – one row per review:

| Field | Description |
|---|---|
| `id`, `url`, `locationId` | review id, review page, hotel id |
| `title`, `text`, `rating` | review content, 1-5 |
| `lang`, `originalLanguage`, `isMachineTranslated` | non-English reviews are delivered in English translation; `originalLanguage` keeps the real language |
| `publishedDate`, `travelDate`, `tripType` | `2026-10-12`, `2026-09`, `COUPLES` / `FAMILY` / `FRIENDS` / `SOLO` / `BUSINESS` / `NONE` |
| `helpfulVotes`, `subratings`, `photos` | votes, per-category ratings (Value, Rooms, Service...), review photos |
| `user` | name, username, hometown, contributions, avatar, profile link |
| `ownerResponse` | `{ id, text, lang, publishedDate, responder, connectionToSubject }`, or `null` |
| `placeInfo` | compact hotel block (with `includePlaceInfo`) |

**Place mode** – one row per hotel: `name`, `rating`, `numberOfReviews`, `ratingHistogram`, `rankingPosition`, `rankingDenominator`, `rankingString`, `hotelClass`, `amenities`, `subRatings`, `roomCount`, `priceRange`, `reviewsByLanguage`, `awards`, `description`, `image`, `photoCount`, `address`, `addressObj`, `latitude`, `longitude`, `webUrl`, `website`, `ancestorLocations`, `geoId`.

**Search mode** – one row per hotel of the area: `id`, `name`, `rating`, `numberOfReviews`, `hotelClass`, `rankingPosition`, `rankingDenominator`, `rankingString`, `webUrl`, `address`, `latitude`, `longitude`, `geoId`, `nearby`, `positionInList`.

A run summary is saved to the key-value store as `SUMMARY`: per hotel the review count on Tripadvisor, reviews fetched and stored, whether the scan was complete, requests and browser rotations.

### Proxy and blocking

Tripadvisor is protected by DataDome. The actor uses Camoufox, a Firefox build with a consistent, realistic fingerprint, which passes the check in a few seconds on residential IPs; plain HTTP clients and headless Chrome get a captcha. After the hotel page has loaded, reviews are read through the site's own data API from inside that page.

Residential proxies are required on Apify. Each hotel keeps one sticky session; when a session is blocked, the actor opens a fresh browser on a new IP (with an Apify Proxy country set, later browsers cycle through NL, GB, AT and FR). To run without a proxy, switch Apify Proxy off; this only works from a connection DataDome trusts.

### Notes

- A full scan of a hotel with ~4,000 reviews takes about 6 minutes; an incremental run with `dateFrom` takes seconds.
- When your run's maximum charge is reached the actor stops cleanly, keeps what was stored and says so in the status message.
- `npm test` runs offline unit tests of the mapping and helper functions.
- Only publicly visible data is collected; no login is used.

# Actor input Schema

## `mode` (type: `string`):

reviews = one item per review of each hotel. place = one snapshot item per hotel (rating, histogram, popularity ranking, address, amenities). search = hotels of an area (query text or geo id → hotel list).

## `startUrls` (type: `array`):

Tripadvisor hotel pages (reviews / place modes), e.g. https://www.tripadvisor.com/Hotel_Review-g1192102-d545626-Reviews-Lago_Hotel-Sorgun_Manavgat_Turkish_Mediterranean_Coast.html . Any locale host works; the ids (-g<geo>-d<id>-) are what counts.

## `maxReviewsPerPlace` (type: `integer`):

Stop after this many reviews per hotel (newest first). 0 = all reviews.

## `dateFrom` (type: `string`):

Only reviews published on/after this (YYYY-MM-DD, full ISO, or relative like '8 days' / '3 months'). Paging is newest first and STOPS once it crosses this floor, so an incremental run costs one or two requests. Empty = full scan.

## `dateTo` (type: `string`):

Only reviews published on/before this (YYYY-MM-DD = whole day, full ISO, or relative). Empty = no upper bound.

## `includePlaceInfo` (type: `boolean`):

Adds a compact `placeInfo` block (name, rating, review count, histogram, address, coordinates) to each review item.

## `queries` (type: `array`):

Place names to list hotels for, e.g. 'Sorgun', 'Kemer'. The first matching Tripadvisor geo is used.

## `geoIds` (type: `array`):

Numeric geo ids, e.g. \[297966] for Kemer (the g… of a /Hotels-g297966-… page). Skips the text lookup; each geo is read until its own hotels run out, up to the page limit, and the maximum below does not apply. Can be combined with queries.

## `hotelClass` (type: `integer`):

Reads the list through Tripadvisor's own star filter (5 = /Hotels-g…-zfc5.html). In a parent geo every row then carries that geo's rank, whichever town the hotel is in. The filter runs out after a few pages and unfiltered hotels follow, so keep scanPages small and check hotelClass on the items.

## `maxResults` (type: `integer`):

Hotels returned per query, in Tripadvisor's popularity order. Not applied to geoIds.

## `scanPages` (type: `integer`):

Hotel list pages (30 hotels each) read per query before the hotels are ranked and cut to the maximum.

## `sortBy` (type: `string`):

reviews = most reviewed first among the scanned hotels. list = Tripadvisor's own list order.

## `includeNearby` (type: `boolean`):

Tripadvisor appends hotels of neighbouring areas after the area's own list. Off = only the area itself.

## `proxyConfiguration` (type: `object`):

Residential proxies are required on Apify: Tripadvisor is protected by DataDome. Each hotel scan keeps one sticky session; a blocked session is replaced by a fresh browser on a new IP. With an Apify Proxy country set, later browsers cycle through NL, GB, AT and FR. To run without a proxy, switch Apify Proxy off.

## `maxRotations` (type: `integer`):

How many times a hotel scan may switch to a fresh browser/IP after a block or a network error before it gives up.

## Actor input object example

```json
{
  "mode": "reviews",
  "startUrls": [
    {
      "url": "https://www.tripadvisor.com/Hotel_Review-g1192102-d545626-Reviews-Lago_Hotel-Sorgun_Manavgat_Turkish_Mediterranean_Coast.html"
    }
  ],
  "maxReviewsPerPlace": 20,
  "includePlaceInfo": true,
  "maxResults": 30,
  "scanPages": 4,
  "sortBy": "reviews",
  "includeNearby": false,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "DE"
  },
  "maxRotations": 10
}
```

# Actor output Schema

## `items` (type: `string`):

Reviews, hotel snapshots or area hotels (JSON, depends on the mode)

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

Per-target counts: total on Tripadvisor, fetched, emitted, completeness, requests, rotations, wire bytes

# 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 = {
    "startUrls": [
        {
            "url": "https://www.tripadvisor.com/Hotel_Review-g1192102-d545626-Reviews-Lago_Hotel-Sorgun_Manavgat_Turkish_Mediterranean_Coast.html"
        }
    ],
    "maxReviewsPerPlace": 20,
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ],
        "apifyProxyCountry": "DE"
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("valiant_quarter/tripadvisor-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 = {
    "startUrls": [{ "url": "https://www.tripadvisor.com/Hotel_Review-g1192102-d545626-Reviews-Lago_Hotel-Sorgun_Manavgat_Turkish_Mediterranean_Coast.html" }],
    "maxReviewsPerPlace": 20,
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
        "apifyProxyCountry": "DE",
    },
}

# Run the Actor and wait for it to finish
run = client.actor("valiant_quarter/tripadvisor-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 '{
  "startUrls": [
    {
      "url": "https://www.tripadvisor.com/Hotel_Review-g1192102-d545626-Reviews-Lago_Hotel-Sorgun_Manavgat_Turkish_Mediterranean_Coast.html"
    }
  ],
  "maxReviewsPerPlace": 20,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "DE"
  }
}' |
apify call valiant_quarter/tripadvisor-hotels-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,valiant_quarter/tripadvisor-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/Wxmx9OH6ctqT2cTSC/builds/07PqkjtLVrKohsCfm/openapi.json
