# Amazon Review Analyzer (`exhaustive_clock/amazon-review-analyzer`) Actor

Downloads up to 500 recent reviews of a competitor on Amazon and, using Claude Sonnet 4, generates a PDF report with top complaints, sentiment, and specific ideas for product improvement.

- **URL**: https://apify.com/exhaustive\_clock/amazon-review-analyzer.md
- **Developed by:** [KS](https://apify.com/exhaustive_clock) (community)
- **Categories:** Agents
- **Stats:** 2 total users, 1 monthly users, 0.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

$1,990.00 / 1,000 pdf report generateds

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

## Amazon Review Analyzer — Apify Actor

Скачивает до 500 свежих отзывов о товаре конкурента на Amazon, прогоняет их через **Claude Sonnet 4** и формирует **PDF-отчёт** с топ-жалобами, тональностью и предложениями по улучшению.

Запускается как **Apify Actor**: вся инфраструктура (Docker, прокси, хранилище) — на стороне Apify. Локально нужен только Apify CLI для деплоя.

---

### Структура проекта

````

E/
├── .actor/
│   ├── actor.json          ## манифест актора
│   ├── INPUT\_SCHEMA.json   ## форма input (URL, max, язык)
│   └── Dockerfile          ## сборка образа
├── src/
│   ├── main.py             ## точка входа, использует Apify SDK
│   ├── apify\_reviews.py    ## input для скрапера + нормализация
│   ├── llm\_analyzer.py     ## Claude Sonnet 4, два языка
│   └── report.py           ## PDF (DejaVu Sans, кириллица)
├── storage/                ## локальное хранилище для apify run
├── requirements.txt
├── .dockerignore
├── .gitignore
└── README.md

````

---

### Деплой через Apify CLI (3 минуты)

#### Шаг 1. Установить CLI

Нужен Node.js (любой LTS, 18+).

```bash
npm install -g apify-cli
apify --version
````

#### Шаг 2. Залогиниться

```bash
apify login
```

Откроется браузер, авторизуешься через Apify Console.

#### Шаг 3. Запушить актор

Из папки `E/`:

```bash
apify push
```

CLI упакует проект и загрузит на платформу. Apify сам соберёт Docker-образ (это займёт 2–4 минуты на первой сборке).

#### Шаг 4. Настроить ANTHROPIC\_API\_KEY в env

После сборки в Apify Console:

1. Открой свой актор → вкладка **Source** → **Environment variables**
2. Жмёшь **Add variable**:
   - **Name**: `ANTHROPIC_API_KEY`
   - **Value**: `sk-ant-...` (твой ключ)
   - **Is secret**: ✅ ставишь галку
3. Сохраняешь.

Всё. Теперь актор знает ключ, но никто (включая тебя в UI) его не увидит.

#### Шаг 5. Запустить

В UI актора → вкладка **Input** → заполнить:

- **productUrls** — URL'ы товаров конкурента (например `https://www.amazon.com/dp/B08N5WRWNW`)
- **maxReviews** — сколько отзывов взять (по умолчанию 500)
- **reportLanguage** — Русский / English

Жмёшь **Start**. Через 1–3 минуты прогон закончится, и в разделе **Storage → Key-value store** появятся:

- **OUTPUT.pdf** — главный отчёт. Скачивается одной кнопкой.
- **raw\_reviews** — исходные отзывы от скрапера (JSON)
- **analysis** — структурированный результат от Claude (JSON, для интеграций)

Сводка анализа также пишется в **Dataset** актора — её можно забирать через API или экспортировать в Excel/CSV прямо из UI.

***

### Локальный прогон (для отладки кода до деплоя)

```bash
cd E
pip install -r requirements.txt
export ANTHROPIC_API_KEY=sk-ant-...
export APIFY_TOKEN=apify_api_...   ## нужен для Actor.call() на платформу
apify run --purge
```

CLI прочитает `storage/key_value_stores/default/INPUT.json` как input. После прогона ищи результат в `storage/key_value_stores/default/OUTPUT`.

***

### Стоимость одного прогона

| Компонент | Примерная цена |
|-----------|----------------|
| Apify (compute units + актор скрапера) | $0.30–1.50 |
| Claude Sonnet 4 (~125k input + 4k output) | $0.45 |
| **Итого** | **~$1 за анализ одного конкурента (500 отзывов)** |

На бесплатном плане Apify ($5 кредитов/мес) хватает на 2–3 прогона.

***

### Замена актора-скрапера

По умолчанию используется `junglee/amazon-reviews-scraper`. Если хочешь подключить другой:

1. Открой в Apify Store нужный актор, скопируй его ID (вид `username/actor-name`)
2. Пропиши его в поле **reviewsScraperActorId** при запуске, либо измени `default` в `.actor/INPUT_SCHEMA.json`
3. Проверь, что структура input совпадает с тем, что строит `build_scraper_input()` в `src/apify_reviews.py`. У большинства акторов поля называются по-разному — поправь маппинг под конкретный

***

### Что под капотом

```
Input (UI)
    ↓
Actor.call("junglee/amazon-reviews-scraper", input)   ← платный, но платформа
    ↓                                                    выставит счёт автоматом
Dataset скрапера → нормализация → text-only reviews
    ↓
Claude Sonnet 4 (system prompt на ru или en)
    ↓
analysis (JSON) ──→ KVS: "analysis"
    │              ──→ Default Dataset (для интеграций)
    │
    └→ reportlab + DejaVu Sans → PDF bytes ──→ KVS: "OUTPUT.pdf"
```

# Actor input Schema

## `productUrls` (type: `array`):

Один или несколько URL продукта конкурента, по которым нужно собрать отзывы. Например: https://www.amazon.com/dp/B0XXXXXXX

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

Сколько свежих отзывов взять с каждого URL (1–1000). Чем больше — тем дороже прогон и точнее анализ.

## `reportLanguage` (type: `string`):

На каком языке Claude должен сформировать отчёт.

## `productLabel` (type: `string`):

Произвольная подпись, которая попадёт в заголовок PDF. Если не указано — будет первый URL.

## `reviewsScraperActorId` (type: `string`):

ID актора, который собирает отзывы Amazon. По умолчанию — junglee/amazon-reviews-scraper. Меняй только если знаешь, что делаешь.

## `anthropicApiKey` (type: `string`):

Если оставить пустым — используется ключ из env актора (рекомендуемый способ, настраивается один раз в Settings → Environment variables). Заполняй только для разового перепрогона.

## Actor input object example

```json
{
  "productUrls": [
    "https://www.amazon.com/dp/B08N5WRWNW"
  ],
  "maxReviews": 500,
  "reportLanguage": "ru",
  "reviewsScraperActorId": "junglee/amazon-reviews-scraper"
}
```

# 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 = {
    "productUrls": [
        "https://www.amazon.com/dp/B08N5WRWNW"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("exhaustive_clock/amazon-review-analyzer").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 = { "productUrls": ["https://www.amazon.com/dp/B08N5WRWNW"] }

# Run the Actor and wait for it to finish
run = client.actor("exhaustive_clock/amazon-review-analyzer").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 '{
  "productUrls": [
    "https://www.amazon.com/dp/B08N5WRWNW"
  ]
}' |
apify call exhaustive_clock/amazon-review-analyzer --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Amazon Review Analyzer",
        "description": "Downloads up to 500 recent reviews of a competitor on Amazon and, using Claude Sonnet 4, generates a PDF report with top complaints, sentiment, and specific ideas for product improvement.",
        "version": "0.1",
        "x-build-id": "y92Gj6uxXwnNXIraB"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/exhaustive_clock~amazon-review-analyzer/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-exhaustive_clock-amazon-review-analyzer",
                "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/exhaustive_clock~amazon-review-analyzer/runs": {
            "post": {
                "operationId": "runs-sync-exhaustive_clock-amazon-review-analyzer",
                "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/exhaustive_clock~amazon-review-analyzer/run-sync": {
            "post": {
                "operationId": "run-sync-exhaustive_clock-amazon-review-analyzer",
                "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": [
                    "productUrls"
                ],
                "properties": {
                    "productUrls": {
                        "title": "URL товаров на Amazon",
                        "minItems": 1,
                        "type": "array",
                        "description": "Один или несколько URL продукта конкурента, по которым нужно собрать отзывы. Например: https://www.amazon.com/dp/B0XXXXXXX",
                        "items": {
                            "type": "string"
                        }
                    },
                    "maxReviews": {
                        "title": "Максимум отзывов",
                        "minimum": 10,
                        "maximum": 1000,
                        "type": "integer",
                        "description": "Сколько свежих отзывов взять с каждого URL (1–1000). Чем больше — тем дороже прогон и точнее анализ.",
                        "default": 500
                    },
                    "reportLanguage": {
                        "title": "Язык PDF-отчёта",
                        "enum": [
                            "ru",
                            "en"
                        ],
                        "type": "string",
                        "description": "На каком языке Claude должен сформировать отчёт.",
                        "default": "ru"
                    },
                    "productLabel": {
                        "title": "Название товара (для шапки отчёта)",
                        "type": "string",
                        "description": "Произвольная подпись, которая попадёт в заголовок PDF. Если не указано — будет первый URL."
                    },
                    "reviewsScraperActorId": {
                        "title": "Apify-актор для скрапинга отзывов",
                        "type": "string",
                        "description": "ID актора, который собирает отзывы Amazon. По умолчанию — junglee/amazon-reviews-scraper. Меняй только если знаешь, что делаешь.",
                        "default": "junglee/amazon-reviews-scraper"
                    },
                    "anthropicApiKey": {
                        "title": "ANTHROPIC_API_KEY (опционально)",
                        "type": "string",
                        "description": "Если оставить пустым — используется ключ из env актора (рекомендуемый способ, настраивается один раз в Settings → Environment variables). Заполняй только для разового перепрогона."
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
