# Amazon Product & Review Scraper (`second_coming/amazon-product-scraper`) Actor

Extract product details, prices, BSR rankings, reviews, Q\&A, and variation data from Amazon product pages. Includes review sentiment analysis and price history tracking.

- **URL**: https://apify.com/second_coming/amazon-product-scraper.md
- **Developed by:** [Richard P](https://apify.com/second_coming) (community)
- **Categories:** E-commerce, Marketing
- **Features:** Limited permissions
- **Stats:** 53 total users, 8 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$0.02 / scan run

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/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

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

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Amazon Product & Review Scraper

[![Apify Actor](https://img.shields.io/badge/Apify-Actor-blue)](https://apify.com/)

A serverless Apify Actor that extracts detailed product data from Amazon product pages — prices, ratings, Best Sellers Rank (BSR), features, images, reviews, Q\&A, and variation data.

### Features

- **Product Details** — Title, brand, ASIN, current/original price, currency
- **Ratings & Reviews** — Star rating, total review count, individual reviews with author/rating/date/title/body/verified status
- **Best Sellers Rank (BSR)** — Rank number and category
- **Availability** — Stock status and availability text
- **Features / Bullet Points** — Key product features
- **Images** — High-resolution product image URLs
- **Variations** — Size, color, style options (optional)
- **Q\&A** — Customer questions and answers (optional)
- **Anti-blocking** — Rotating user-agents (8+), random delays (1–3s), exponential-backoff retries (max 3), fallback selectors
- **Graceful Abort** — Handles Apify platform abort signals cleanly

### Input Schema

| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `urls` | `string[]` | — | **Required.** Amazon product URLs to scrape. Supports `/dp/ASIN` and `/gp/product/` formats. |
| `maxReviews` | `integer` | `50` | Maximum reviews to scrape per product (0 = skip). Max 500. |
| `includeReviews` | `boolean` | `true` | Scrape customer reviews. |
| `includeQA` | `boolean` | `true` | Scrape questions & answers. |
| `includeVariations` | `boolean` | `false` | Scrape variation data (size/color/style). |
| `proxyConfiguration` | `object` | — | Apify proxy config for cloud runs. |

#### Example Input

```json
{
  "urls": ["https://www.amazon.com/dp/B0CNBGX3GZ"],
  "maxReviews": 20,
  "includeReviews": true,
  "includeQA": true,
  "includeVariations": false
}
```

### Output

Each product is pushed as a separate dataset item with the following fields:

| Field | Type | Description |
|-------|------|-------------|
| `productUrl` | `string` | Original input URL |
| `asin` | `string` | Amazon Standard Identification Number |
| `title` | `string` | Product title |
| `brand` | `string` | Brand name |
| `currentPrice` | `string` | Current selling price |
| `originalPrice` | `string` | List / MSRP price (if available) |
| `currency` | `string` | Currency symbol ($, £, €, etc.) |
| `rating` | `string` | Star rating (e.g. "4.5") |
| `reviewCount` | `integer` | Number of ratings |
| `bsr` | `string` | Best Sellers Rank (e.g. "#1,234") |
| `bsrCategory` | `string` | BSR category name |
| `availability` | `string` | Availability text |
| `inStock` | `boolean` | Whether product is in stock |
| `features` | `string[]` | Bullet-point feature list |
| `images` | `string[]` | Product image URLs (high-res) |
| `variations` | `object[]` | Variation options (if requested) |
| `reviews` | `object[]` | Customer reviews (if requested) |
| `qa` | `object[]` | Questions & answers (if requested) |
| `scrapedAt` | `string` | ISO 8601 timestamp |

#### Review Object

```json
{
  "author": "John D.",
  "rating": "5.0",
  "date": "Reviewed in the United States on January 15, 2025",
  "title": "Great product!",
  "body": "Really impressed with the quality...",
  "verified": true
}
```

#### Q\&A Object

```json
{
  "question": "Does this work with iPhone 15?",
  "answer": "Yes, it works with all MagSafe compatible cases.",
  "date": "Answered on December 10, 2024"
}
```

### Local Development

#### Prerequisites

- Python 3.11+
- [Apify CLI](https://docs.apify.com/cli) (`npm install -g apify-cli`)
- `uv` or standard venv for dependency management

#### Setup

```bash
## Clone / enter the actor directory
cd amazon-product-scraper

## Create and activate a virtual environment
python3 -m venv .venv
source .venv/bin/activate

## Install dependencies
pip install -r requirements.txt

## Run the actor locally
apify run --purge
```

#### Test with Sample Input

The actor will prompt for input. Provide:

```json
{
  "urls": ["https://www.amazon.com/dp/B0CNBGX3GZ"],
  "maxReviews": 5,
  "includeReviews": true,
  "includeQA": true,
  "includeVariations": false
}
```

Or use the `--input` flag with a JSON file:

```bash
echo '{"urls":["https://www.amazon.com/dp/B0CNBGX3GZ"],"maxReviews":5,"includeReviews":true,"includeQA":true}' > test-input.json
apify run --purge --input-file test-input.json
```

Results appear in `storage/datasets/default/`.

### Deployment to Apify Cloud

```bash
## Login to Apify
apify login --token "YOUR_API_TOKEN"

## Push to cloud
apify push
```

### Notes on Amazon Blocking

Amazon actively blocks automated requests. This actor uses several techniques to mitigate this:

1. **User-agent rotation** — 8 different browser/user-agent combinations
2. **Random delays** — 1–3 seconds between requests (configurable)
3. **Exponential backoff** — Retries with 2s, 4s, 8s waits (max 3 attempts)
4. **Fallback selectors** — Multiple CSS selector strategies for each field
5. **Captcha detection** — Detects block pages and retries

For production deployment on Apify, enabling the **Apify proxy** (residential proxies) significantly improves success rates.

### License

MIT

# Actor input Schema

## `urls` (type: `array`):

One or more Amazon product detail page URLs to scrape. Supports standard /dp/ASIN and /gp/product/ formats.

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

Maximum number of reviews to scrape per product. Set to 0 to skip reviews entirely.

## `includeReviews` (type: `boolean`):

If true, scrape customer reviews for each product.

## `includeQA` (type: `boolean`):

If true, scrape customer questions and answers for each product.

## `includeVariations` (type: `boolean`):

If true, scrape product variation/options data (size, color, etc.).

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

Optional Apify proxy configuration for cloud runs. Leave empty for direct requests.

## Actor input object example

```json
{
  "urls": [
    "https://www.amazon.com/dp/B0CNBGX3GZ"
  ],
  "maxReviews": 50,
  "includeReviews": true,
  "includeQA": true,
  "includeVariations": false,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# 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 = {
    "urls": [
        "https://www.amazon.com/dp/B0CNBGX3GZ"
    ],
    "proxyConfiguration": {
        "useApifyProxy": false
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("second_coming/amazon-product-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 = {
    "urls": ["https://www.amazon.com/dp/B0CNBGX3GZ"],
    "proxyConfiguration": { "useApifyProxy": False },
}

# Run the Actor and wait for it to finish
run = client.actor("second_coming/amazon-product-scraper").call(run_input=run_input)

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

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

```

## CLI example

```bash
echo '{
  "urls": [
    "https://www.amazon.com/dp/B0CNBGX3GZ"
  ],
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}' |
apify call second_coming/amazon-product-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,second_coming/amazon-product-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/tNWSNx5Ywi2i4UYaf/builds/3Lqo20rFlqBnIjSWS/openapi.json
