# **Trip.com Search Prompt** (`dtrungtin/trip-com-search-prompt`) Actor

Scrape Trip.com hotels from a **plain-English prompt** — no URL building required. Describe what you're looking for (for example, *"3-star hotels in Shanghai for two adults"*), and the Actor uses AI to turn your prompt into multiple targeted Trip.com search URLs, scrapes the matching hotels

- **URL**: https://apify.com/dtrungtin/trip-com-search-prompt.md
- **Developed by:** [Tin](https://apify.com/dtrungtin) (community)
- **Categories:** AI, Travel
- **Stats:** 2 total users, 1 monthly users, 75.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.20 / actor start

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

### What does Trip.com Search Prompt do?

**Trip.com Search Prompt** lets you scrape [Trip.com](https://www.trip.com/) hotels from a **plain-English prompt** — no URL building required. Describe what you're looking for (for example, *"3-star hotels in Hanoi near the Old Quarter for two adults next weekend"*), and the Actor uses AI to turn your prompt into targeted Trip.com hotel list URLs, scrapes the matching hotels, and stores them as a structured dataset.

Under the hood, it chains three Actors together:

1. [AI Scraper Input Generator](https://apify.com/dtrungtin/ai-scraper-input-generator) converts your prompt into Trip.com hotel list URLs.
2. [Trip.com Actor](https://apify.com/dtrungtin/trip-com-actor) crawls those URLs and extracts the hotel details — name, star rating, guest rating, review count, room, price, and more.
3. AI Dataset Search then searches the scraped results with your original prompt and stores a link to the best matches in the run's `OUTPUT` record.

Because it runs on the Apify platform, you get **API access, scheduling, monitoring, and integrations** (Make, Zapier, webhooks, Google Drive, and more) out of the box.

### Why use Trip.com Search Prompt?

- **No manual URL construction** — describe your intent in natural language, and the AI handles Trip.com's search URL format, city codes, dates, and filters.
- **Better coverage** — one prompt becomes several targeted search URL variations, surfacing hotels a single query would miss.
- **Travel research made simple** — schedule a run of "cheap hotels in Da Nang with rating above 8.5" and feed the results into your own database.
- **Price and market monitoring** — build datasets of hotels by city, star level, or price range for analysis and comparison.
- **Automation-ready** — predictable JSON output that plugs straight into data pipelines and integrations.

### How to use Trip.com Search Prompt

1. Open the Actor in Apify Console.
2. In the **Input** tab, enter your search prompt in plain English.
3. Optionally adjust **Max items** to limit how many hotels are scraped.
4. Set the Actor's memory to **128 MB or less** in the run options (the Actor enforces this limit, since the heavy lifting happens in the chained Actors).
5. Click **Start** and wait for the run to finish.
6. Open the **Output** tab or the dataset API URL to view and export your results.

### Input

Set the input in the Actor's Input tab. Only the prompt is required.

```json
{
    "prompt": "3-star hotels in Hanoi near the Old Quarter for two adults",
    "maxItems": 50
}
```

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| prompt | string | Yes | Plain-English description of the hotels to find on Trip.com. City, dates, number of guests, star level, and budget all improve results. |
| maxItems | integer | No | Maximum number of hotels to scrape (default 10, maximum 500). |
| numberOfUrls | integer | No | How many search URL variations the AI generates from your prompt (default 3). |
| targetActor | string | No | Scraper Actor to run on the generated URLs (default `dtrungtin/trip-com-actor`). |
| websiteDomain | string | No | Website domain hint passed to the URL generator (e.g. `trip.com`). |

### Output

Each scraped Trip.com hotel is stored as one item in the default dataset. You can download the dataset in various formats such as JSON, HTML, CSV, or Excel. The run's `OUTPUT` record in the key-value store additionally contains `searchResultsDatasetUrl` — a link to the AI-filtered results that best match your prompt.

Example dataset item:

```json
{
    "hotelId": 703714,
    "name": "A25 Premium Hotel - 15 Tran Quoc Toan",
    "url": "https://www.trip.com/hotels/detail/?cityEnName=Hanoi&cityId=286&hotelId=703714",
    "stars": 3,
    "rating": 8.8,
    "reviewCount": 72,
    "locations": ["Hồ Hoàn Kiếm Area", "Near Hanoi Old Quarter"],
    "tags": ["Breakfast included", "Special Discount", "5% off"],
    "roomName": "Deluxe Twin",
    "price": 33,
    "originalPrice": 35,
    "totalPrice": 37,
    "currency": "USD",
    "priceText": "US$33",
    "totalPriceText": "Total (incl. taxes & fees): US$37",
    "checkIn": "2026-07-30",
    "checkOut": "2026-07-31",
    "adults": 2,
    "children": 0,
    "sourceUrl": "https://www.trip.com/hotels/list?city=286&checkIn=2026-07-30&checkOut=2026-07-31&adult=2",
    "scrapedAt": "2026-08-01T03:34:43.534Z"
}
```

### Data table

| Field | Type | Description |
| --- | --- | --- |
| hotelId | number | Trip.com hotel ID |
| name | string | Hotel name |
| url | string | Direct link to the hotel detail page |
| stars | number | Star classification of the hotel |
| rating | number | Guest review score (out of 10) |
| reviewCount | number | Number of guest reviews |
| locations | array | Area and landmark descriptions |
| tags | array | Deal and amenity tags (e.g. breakfast, discounts) |
| roomName | string | Cheapest offered room type |
| price | number | Nightly price for the offered room |
| originalPrice | number | Price before discount |
| totalPrice | number | Total stay price including taxes and fees |
| currency | string | Price currency |
| checkIn / checkOut | string | Stay dates used for the search |
| adults / children | number | Guest counts used for the search |
| sourceUrl | string | The generated list URL the hotel was found on |
| scrapedAt | string | Timestamp of extraction |

Exact fields may vary slightly by hotel, since not all Trip.com listings expose the same attributes.

### How much does it cost to scrape Trip.com with a prompt?

A run consists of three parts: this orchestrator Actor (very light — it runs at 128 MB and mostly waits), one short AI Scraper Input Generator run, and the Trip.com Actor run. The Trip.com Actor uses a headless browser with **residential proxies** (Trip.com has strong anti-bot protection), so it dominates the cost — as a reference, a run scraping around 500 hotels consumes roughly **$0.40** of platform usage. Use **Max items** to cap the scraping cost of each run, and start with small values to see actual consumption before scaling up.

### Tips

- **Be specific in your prompt.** "4-star hotels in Ho Chi Minh City under $60 for two adults in September" produces much better search URLs than "hotels in Vietnam".
- **Include dates and guests.** Trip.com prices depend on check-in/check-out dates and occupancy, so mentioning them keeps results realistic.
- **Start small.** Run with a low `maxItems` first to check that the generated URLs match your intent, then scale up (maximum 500).
- **Schedule it.** Add the Actor to a Schedule to track price changes in a city, and connect a webhook or integration to act on the results.
- **Keep memory at 128 MB.** The Actor intentionally refuses to run with more, because the chained Actors do the actual work — extra memory would only add cost.

### FAQ, disclaimers, and support

**Is it legal to scrape Trip.com?** This Actor extracts publicly available hotel data. You are responsible for reviewing and complying with Trip.com's Terms of Service and applicable laws (including data protection regulations) before using the results, especially in automated or commercial workflows. Do not collect or misuse personal data.

**Why did my run fail with a memory error?** This Actor requires memory of 128 MB or less. Lower the memory setting in the run options and start it again.

**Why are there no results?** If the AI could not generate valid search URLs from your prompt, the run fails with a clear error — rephrase the prompt with more specific city, date, or budget terms and try again.

Found a bug or need a custom feature? Open an issue in the Actor's **Issues** tab — custom solutions and tailored versions are available on request.

# Actor input Schema

## `prompt` (type: `string`):

Describe what you want to search for on eBay. The Actor will generate search URLs from this prompt and scrape the results.

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

Limit of detail/product pages to be scraped

## Actor input object example

```json
{
  "prompt": "Shanghai",
  "maxItems": 50
}
```

# 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 = {
    "prompt": "Shanghai",
    "maxItems": 50
};

// Run the Actor and wait for it to finish
const run = await client.actor("dtrungtin/trip-com-search-prompt").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 = {
    "prompt": "Shanghai",
    "maxItems": 50,
}

# Run the Actor and wait for it to finish
run = client.actor("dtrungtin/trip-com-search-prompt").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 '{
  "prompt": "Shanghai",
  "maxItems": 50
}' |
apify call dtrungtin/trip-com-search-prompt --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

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