# 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
- **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 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 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("💾 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 '{
  "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": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=second_coming/amazon-product-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Amazon Product & Review Scraper",
        "description": "Extract product details, prices, BSR rankings, reviews, Q&A, and variation data from Amazon product pages. Includes review sentiment analysis and price history tracking.",
        "version": "0.0",
        "x-build-id": "wmZtgKNF8zdlhiOxu"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/second_coming~amazon-product-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-second_coming-amazon-product-scraper",
                "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/second_coming~amazon-product-scraper/runs": {
            "post": {
                "operationId": "runs-sync-second_coming-amazon-product-scraper",
                "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/second_coming~amazon-product-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-second_coming-amazon-product-scraper",
                "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": [
                    "urls"
                ],
                "properties": {
                    "urls": {
                        "title": "Amazon Product URLs",
                        "type": "array",
                        "description": "One or more Amazon product detail page URLs to scrape. Supports standard /dp/ASIN and /gp/product/ formats.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "maxReviews": {
                        "title": "Max Reviews",
                        "minimum": 0,
                        "maximum": 500,
                        "type": "integer",
                        "description": "Maximum number of reviews to scrape per product. Set to 0 to skip reviews entirely.",
                        "default": 50
                    },
                    "includeReviews": {
                        "title": "Include Reviews",
                        "type": "boolean",
                        "description": "If true, scrape customer reviews for each product.",
                        "default": true
                    },
                    "includeQA": {
                        "title": "Include Q&A",
                        "type": "boolean",
                        "description": "If true, scrape customer questions and answers for each product.",
                        "default": true
                    },
                    "includeVariations": {
                        "title": "Include Variations",
                        "type": "boolean",
                        "description": "If true, scrape product variation/options data (size, color, etc.).",
                        "default": false
                    },
                    "proxyConfiguration": {
                        "title": "Proxy Configuration",
                        "type": "object",
                        "description": "Optional Apify proxy configuration for cloud runs. Leave empty for direct requests."
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
