# Trustpilot Review Theme Miner (`isotonic/trustpilot-review-theme-miner`) Actor

Mine Trustpilot reviews for recurring complaints, praise themes, competitor weaknesses, and customer language, with structured research exports.

- **URL**: https://apify.com/isotonic/trustpilot-review-theme-miner.md
- **Developed by:** [Brian Keefe](https://apify.com/isotonic) (community)
- **Categories:** E-commerce, Business, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

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

## 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

## Trustpilot Review Theme Miner

Production-oriented Apify Actor that reads public Trustpilot company review pages, extracts available review fields, and derives complaint themes, praise themes, sentiment, urgency, competitor mentions, product mentions, rating distributions, date distributions, and representative quotes.

### Public-data posture

- Trustpilot-first only.
- Uses public company review pages only.
- Does not require login.
- Does not use private APIs, anti-bot bypasses, or hidden endpoints.
- Gracefully reports public-access failures such as `403`, `429`, and network errors in output source evidence.

### Input

The actor accepts either `companyProfileUrls`, `domains`, or both. Runtime validation enforces that at least one entry is provided.

```json
{
  "companyProfileUrls": [
    "https://www.trustpilot.com/review/example.com"
  ],
  "domains": [
    "example.org"
  ],
  "maxReviews": 25,
  "ratings": [1, 2, 4, 5],
  "dateFrom": "2024-01-01",
  "dateTo": "2024-12-31",
  "includeRawReviews": true,
  "maxQuotesPerTheme": 2
}
```

#### Input fields

- `companyProfileUrls`: array of Trustpilot company review profile URLs.
- `domains`: array of bare domains, converted to `https://www.trustpilot.com/review/<domain>`.
- `maxReviews`: maximum reviews to include per company, capped at `500`.
- `ratings`: allowed star ratings from `1` to `5`.
- `dateFrom`: inclusive ISO date lower bound.
- `dateTo`: inclusive ISO date upper bound.
- `includeRawReviews`: when `true`, includes the extracted raw review records in the final dataset item.
- `maxQuotesPerTheme`: number of quotes kept per derived theme.

### Output

Each dataset item contains:

- `input`: normalized target domain and Trustpilot profile URL.
- `company`: detected company name and canonical profile URL.
- `source`: public-data evidence, page fetch statuses, retries, and stop reason.
- `summary`: review counts and applied filters.
- `analysis.sentiment`: positive, neutral, negative counts and average rating.
- `analysis.complaintThemes`: negative-rating themes with evidence and representative quotes.
- `analysis.praiseThemes`: positive-rating themes with evidence and representative quotes.
- `analysis.urgencySignals`: urgent complaint evidence.
- `analysis.competitorMentions`: mentions extracted from phrases like `vs`, `versus`, or `compared to`.
- `analysis.productMentions`: recurring product or experience terms.
- `analysis.ratingDistribution`: counts for ratings `1` through `5`.
- `analysis.dateDistribution`: monthly review counts in `YYYY-MM` form.
- `analysis.representativeQuotes`: overall positive and negative quote samples.
- `reviews`: included only when `includeRawReviews` is `true`.

See `examples/sample-input.json` and `examples/sample-output.json`.

### Extraction notes

- The parser prioritizes public Trustpilot review-card HTML and JSON-LD review nodes when present.
- Extracted review fields include title, body, rating, date, reviewer metadata when available, and the source URL.
- Pagination is attempted via `?page=<n>` URLs while reviews remain and public pages continue to return content.

### Limitations

- Trustpilot can rate-limit or block public access. The actor surfaces those events in `source.pageFetches` and stops cleanly.
- Public page structures can change. The parser is intentionally narrow and relies on public review cards and public JSON-LD.
- Theme derivation is heuristic. It is deterministic and maintainable, but not a substitute for a bespoke NLP model.
- Competitor and product mention extraction is pattern-based and may miss implicit references.

### Local usage

Install dependencies:

```bash
npm install
```

Run the deterministic smoke test:

```bash
npm test
```

Run locally with Apify input storage or environment-provided input:

```bash
npm start
```

### Publish

With the Apify CLI authenticated:

```bash
apify push
```

# Actor input Schema

## `companyProfileUrls` (type: `array`):

Full Trustpilot company review profile URLs such as https://www.trustpilot.com/review/example.com.

## `domains` (type: `array`):

Company domains to resolve to Trustpilot review pages.

## `maxReviews` (type: `integer`):

Maximum number of public Trustpilot reviews to collect and analyze per company profile.

## `ratings` (type: `array`):

Only include these star ratings.

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

Inclusive ISO date filter, for example 2024-01-01.

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

Inclusive ISO date filter, for example 2024-12-31.

## `includeRawReviews` (type: `boolean`):

When enabled, include the extracted review rows in addition to the derived theme analysis.

## `maxQuotesPerTheme` (type: `integer`):

Maximum number of evidence quotes to include for each detected complaint or praise theme.

## Actor input object example

```json
{
  "companyProfileUrls": [
    "https://www.trustpilot.com/review/example.com"
  ],
  "domains": [
    "example.com"
  ],
  "maxReviews": 50,
  "ratings": [
    "1",
    "2",
    "3",
    "4",
    "5"
  ],
  "includeRawReviews": false,
  "maxQuotesPerTheme": 3
}
```

# 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 = {
    "companyProfileUrls": [
        "https://www.trustpilot.com/review/example.com"
    ],
    "domains": [
        "example.com"
    ],
    "ratings": [
        "1",
        "2",
        "3",
        "4",
        "5"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("isotonic/trustpilot-review-theme-miner").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 = {
    "companyProfileUrls": ["https://www.trustpilot.com/review/example.com"],
    "domains": ["example.com"],
    "ratings": [
        "1",
        "2",
        "3",
        "4",
        "5",
    ],
}

# Run the Actor and wait for it to finish
run = client.actor("isotonic/trustpilot-review-theme-miner").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 '{
  "companyProfileUrls": [
    "https://www.trustpilot.com/review/example.com"
  ],
  "domains": [
    "example.com"
  ],
  "ratings": [
    "1",
    "2",
    "3",
    "4",
    "5"
  ]
}' |
apify call isotonic/trustpilot-review-theme-miner --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=isotonic/trustpilot-review-theme-miner",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

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