# Ctrip / Trip.com Hotel Scraper - Prices, Ratings & Availability (`thirdwatch/ctrip-hotels-scraper`) Actor

Scrape hotel listings from Trip.com (Ctrip): names, nightly prices, ratings, reviews, location, star class, amenities, photos. Supports city, check-in/out dates, guests, and rooms.

- **URL**: https://apify.com/thirdwatch/ctrip-hotels-scraper.md
- **Developed by:** [Thirdwatch](https://apify.com/thirdwatch) (community)
- **Categories:** Travel
- **Stats:** 5 total users, 4 monthly users, 52.9% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

from $30.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.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## Ctrip / Trip.com Hotel Scraper

Scrape hotel listings from **Trip.com** (the English face of Ctrip): prices, ratings, reviews, location, star class, amenities, room types, and photos for any city and date range.

### What you get per hotel

| Field | Description |
| --- | --- |
| `hotel_name` | Hotel name |
| `hotel_id` | Trip.com internal hotel ID |
| `url` | Detail page URL |
| `price` | Lowest nightly rate seen |
| `currency` | Currency code (USD default) |
| `original_price` | Crossed-out / pre-discount price when present |
| `rating` | User rating (0-5 scale on Trip.com) |
| `rating_label` | "Excellent" / "Very good" / etc. |
| `reviews_count` | Total user reviews |
| `stars` | Star class (1-5) |
| `address` | Street / area description |
| `city`, `district` | Location breakdown |
| `latitude`, `longitude` | Map coordinates |
| `image_url` | Primary photo |
| `amenities` | List of facility names |
| `room_types` | Sample room types from card |
| `tags` | Promotional / property tags |
| `distance_from_center` | When Trip.com provides it |
| `checkin_date`, `checkout_date`, `search_city` | Echoed inputs |
| `source` | `"api"` (preferred) or `"dom"` (fallback) |

### Input

```json
{
  "city": "Tokyo",
  "cityId": 228,
  "checkIn": "2026-06-01",
  "checkOut": "2026-06-03",
  "guests": 2,
  "rooms": 1,
  "maxResults": 50
}
````

`cityId` is **strongly recommended** for production. Trip.com's hotel list endpoint requires a numeric city ID — passing only a city name does **not** drive a search. The actor has a small built-in map of verified IDs (Tokyo 228, Singapore 73, Beijing 1, Shanghai 2, Madrid 357, Granada 717, New Delhi 495) and tries an in-browser autocomplete fallback for everything else, but the autocomplete resolver is not 100% reliable. To grab a cityId by hand, open `https://www.trip.com/hotels/list?city=<id>` for guesses and check the page title.

### How it works

Trip.com renders its hotel list entirely client-side, behind a stealth-defence script (`hotel-spider-defence`) and a jigsaw CAPTCHA. Pure HTTP requests to the public `fetchHotelList` SOA endpoint are rejected without the dynamic `testab` token minted by the in-page JS.

The actor uses **Camoufox** (stealth Firefox) with Apify Residential proxy, performs a homepage warmup to settle session cookies, and then:

1. Attaches a `page.on("response")` listener **before navigation**, capturing every JSON response on `/restapi/soa2/34951/fetchHotelList`.
2. Loads `/hotels/list?city=<id>&checkin=&checkout=&adult=&crn=` and scrolls to trigger pagination / dynamic refresh XHRs.
3. Recursively walks each captured JSON for hotel records (matches dicts that look like a hotel: have `hotelBasicInfo`, or both `hotelName` and `hotelId`).
4. Falls back to anchor-based DOM extraction (`a[href*="/hotels/detail/"]` walked up to the smallest container with an image + meaningful text) if the API capture comes up short.

This is the same XHR-intercept pattern used by `meesho-scraper` and `tatacliq-scraper` in this repo.

### Pricing (PPE)

| Tier | Per result |
| --- | --- |
| FREE | $0.008 |
| BRONZE | $0.006 |
| SILVER | $0.005 |
| GOLD | $0.004 |

### Known limits

- **Pagination is XHR-driven, not URL-driven.** We rely on scrolling to fetch additional pages; 50-100 hotels per run is the comfortable ceiling. Larger `maxResults` may stall.
- **CAPTCHA risk.** Trip.com occasionally serves a jigsaw challenge to fresh proxy IPs. The actor retries up to 3 times with new browsers; persistent failures usually mean the proxy IP is currently flagged.
- **Currency.** All requests are pinned to USD via the `curr` URL param. Trip.com may still echo back rates that include local taxes/fees.
- **City ID auto-resolve is best-effort.** For ambiguous city names, supply `cityId` directly.

# Actor input Schema

## `city` (type: `string`):

City name to search hotels in. Examples: 'Tokyo', 'Bangkok', 'Paris', 'Singapore'.

## `cityId` (type: `integer`):

Trip.com internal city ID. If known, this is faster and more reliable than the city name. Example: 228 for Tokyo, 187 for Paris. Leave blank to auto-resolve from city name.

## `checkIn` (type: `string`):

Check-in date in YYYY-MM-DD format.

## `checkOut` (type: `string`):

Check-out date in YYYY-MM-DD format.

## `guests` (type: `integer`):

Number of adult guests.

## `rooms` (type: `integer`):

Number of rooms.

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

Maximum number of hotels to scrape.

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

Proxy settings. Residential proxies recommended for reliability.

## Actor input object example

```json
{
  "city": "Tokyo",
  "checkIn": "2026-12-01",
  "checkOut": "2026-12-03",
  "guests": 2,
  "rooms": 1,
  "maxResults": 50,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# 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 = {
    "city": "Tokyo",
    "checkIn": "2026-12-01",
    "checkOut": "2026-12-03",
    "guests": 2,
    "rooms": 1,
    "maxResults": 50
};

// Run the Actor and wait for it to finish
const run = await client.actor("thirdwatch/ctrip-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 = {
    "city": "Tokyo",
    "checkIn": "2026-12-01",
    "checkOut": "2026-12-03",
    "guests": 2,
    "rooms": 1,
    "maxResults": 50,
}

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

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

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

```

## CLI example

```bash
echo '{
  "city": "Tokyo",
  "checkIn": "2026-12-01",
  "checkOut": "2026-12-03",
  "guests": 2,
  "rooms": 1,
  "maxResults": 50
}' |
apify call thirdwatch/ctrip-hotels-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=thirdwatch/ctrip-hotels-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Ctrip / Trip.com Hotel Scraper - Prices, Ratings & Availability",
        "description": "Scrape hotel listings from Trip.com (Ctrip): names, nightly prices, ratings, reviews, location, star class, amenities, photos. Supports city, check-in/out dates, guests, and rooms.",
        "version": "1.0",
        "x-build-id": "rForN1AaLAUPIW7KK"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/thirdwatch~ctrip-hotels-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-thirdwatch-ctrip-hotels-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/thirdwatch~ctrip-hotels-scraper/runs": {
            "post": {
                "operationId": "runs-sync-thirdwatch-ctrip-hotels-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/thirdwatch~ctrip-hotels-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-thirdwatch-ctrip-hotels-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "city",
                    "checkIn",
                    "checkOut"
                ],
                "properties": {
                    "city": {
                        "title": "City",
                        "type": "string",
                        "description": "City name to search hotels in. Examples: 'Tokyo', 'Bangkok', 'Paris', 'Singapore'.",
                        "default": "Tokyo"
                    },
                    "cityId": {
                        "title": "Trip.com City ID (optional)",
                        "type": "integer",
                        "description": "Trip.com internal city ID. If known, this is faster and more reliable than the city name. Example: 228 for Tokyo, 187 for Paris. Leave blank to auto-resolve from city name."
                    },
                    "checkIn": {
                        "title": "Check-in Date",
                        "type": "string",
                        "description": "Check-in date in YYYY-MM-DD format.",
                        "default": "2026-12-01"
                    },
                    "checkOut": {
                        "title": "Check-out Date",
                        "type": "string",
                        "description": "Check-out date in YYYY-MM-DD format.",
                        "default": "2026-12-03"
                    },
                    "guests": {
                        "title": "Guests (Adults)",
                        "minimum": 1,
                        "maximum": 10,
                        "type": "integer",
                        "description": "Number of adult guests.",
                        "default": 2
                    },
                    "rooms": {
                        "title": "Rooms",
                        "minimum": 1,
                        "maximum": 5,
                        "type": "integer",
                        "description": "Number of rooms.",
                        "default": 1
                    },
                    "maxResults": {
                        "title": "Max Results",
                        "minimum": 1,
                        "maximum": 500,
                        "type": "integer",
                        "description": "Maximum number of hotels to scrape.",
                        "default": 50
                    },
                    "proxyConfiguration": {
                        "title": "Proxy Configuration",
                        "type": "object",
                        "description": "Proxy settings. Residential proxies recommended for reliability.",
                        "default": {
                            "useApifyProxy": true,
                            "apifyProxyGroups": [
                                "RESIDENTIAL"
                            ]
                        }
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
