# Trip.com Hotel Scraper (`moving_beacon-owner1/trip-com-hotel-scraper`) Actor

Trip.com Hotel Scraper extracts hotel listings from Trip.com search results, collecting prices, ratings, reviews, room details, hotel links, and images. It supports lazy-loaded pages, optional pagination, and exports structured data to the Apify dataset.

- **URL**: https://apify.com/moving\_beacon-owner1/trip-com-hotel-scraper.md
- **Developed by:** [Jamshaid Arif](https://apify.com/moving_beacon-owner1) (community)
- **Categories:** Travel, Automation, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $10.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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — 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

## Trip.com Hotel Scraper (Apify Actor)

Renders Trip.com hotel-list pages , scrolls
to lazy-load the listing cards, and extracts structured hotel data into the actor's
dataset.

### What it collects

Per hotel card: `name`, `price`, `currency`, `priceText` (raw label), `reviewScore`,
`reviewCount` (number) + `reviewCountText`, `starRating` + `starRatingLabel`,
`roomName`, `hotelUrl`, `hotelId`, `imageUrl`, plus `sourceUrl` and `scrapedAt` (UTC ISO).

### Input

| Field | Type | Default | Notes |
|---|---|---|---|
| `startUrls` | array of URLs | London search | Trip.com hotel-list URLs. Run a search and copy the URL. |
| `maxItems` | integer | 100 | Cap across all URLs. |
| `maxPages` | integer | 1 | Pages to paginate (needs `nextButtonSelector`). |
| `nextButtonSelector` | string | "" | Optional CSS selector for Trip.com's next-page control. Empty = single page. |
| `scrolls` | integer | 8 | Lazy-load scroll iterations per page. |
| `scrollPauseSecs` | integer | 1 | Pause after each scroll. |
| `cardWaitSecs` | integer | 25 | How long to wait for the first cards. |
| `navigationTimeoutSecs` | integer | 60 | Page-load timeout. |
| `proxyConfiguration` | proxy | Apify proxy on | Residential recommended. |
| `headless` | boolean | true | Uncheck for local debugging. |

#### Example input

```json
{
  "startUrls": [{ "url": "https://www.trip.com/hotels/list?city=338" }],
  "maxItems": 60,
  "scrolls": 10,
  "proxyConfiguration": { "useApifyProxy": true, "apifyProxyGroups": ["RESIDENTIAL"] }
}
```

### Output (one dataset item per hotel)

```json
{
  "name": "The Strand Palace",
  "priceText": "US$77",
  "price": "77",
  "currency": "US$",
  "reviewScore": "8.2",
  "reviewCount": 501,
  "reviewCountText": "501 reviews",
  "starRating": "4",
  "starRatingLabel": "4 out of 5 rating",
  "roomName": "Deluxe Double Room",
  "hotelUrl": "https://www.trip.com/hotels/london-hotel-detail-123.html",
  "hotelId": "123",
  "imageUrl": "https://...",
  "sourceUrl": "https://www.trip.com/hotels/list?city=338",
  "scrapedAt": "2026-06-28T10:00:00+00:00"
}
```

# Actor input Schema

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

Trip.com hotel-list page URLs, e.g. https://www.trip.com/hotels/list?city=338 (city 338 = London). Run a search on trip.com and copy the URL to bake in dates/occupancy.

## `maxItems` (type: `integer`):

Maximum number of hotels to collect across all URLs.

## `maxPages` (type: `integer`):

Result pages to paginate per URL. Only used if a 'next button selector' is set; otherwise one scroll-loaded page is scraped.

## `nextButtonSelector` (type: `string`):

Optional CSS selector for Trip.com's 'next page' control. Leave empty to scrape a single scroll-loaded page. Set it to enable pagination up to 'Max pages'.

## `scrolls` (type: `integer`):

Safety cap on scroll iterations. Scrolling stops automatically when no new cards load or enough hotels are collected, so this is just an upper bound.

## `scrollPauseSecs` (type: `integer`):

Wait time after each scroll so new cards can load.

## `cardWaitSecs` (type: `integer`):

How long to wait for the first listing cards to appear before scrolling.

## `navigationTimeoutSecs` (type: `integer`):

Maximum time to wait for a page to load.

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

Proxy settings. Residential proxies recommended — Trip.com may rate-limit datacenter IPs.

## `headless` (type: `boolean`):

Uncheck only for local debugging.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://www.trip.com/hotels/list?city=338"
    }
  ],
  "maxItems": 100,
  "maxPages": 1,
  "nextButtonSelector": "",
  "scrolls": 25,
  "scrollPauseSecs": 6,
  "cardWaitSecs": 25,
  "navigationTimeoutSecs": 60,
  "proxyConfiguration": {
    "useApifyProxy": false
  },
  "headless": true
}
```

# 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.trip.com/hotels/list?city=338"
        }
    ],
    "proxyConfiguration": {
        "useApifyProxy": false
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("moving_beacon-owner1/trip-com-hotel-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.trip.com/hotels/list?city=338" }],
    "proxyConfiguration": { "useApifyProxy": False },
}

# Run the Actor and wait for it to finish
run = client.actor("moving_beacon-owner1/trip-com-hotel-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 '{
  "startUrls": [
    {
      "url": "https://www.trip.com/hotels/list?city=338"
    }
  ],
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}' |
apify call moving_beacon-owner1/trip-com-hotel-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

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