# Amazon Ratings Scraper (`suraj_pp/amazon-ratings-scraper`) Actor

This is the scraper built to scrap 1000+ product ratings, ratings count, stars percentage.

- **URL**: https://apify.com/suraj\_pp/amazon-ratings-scraper.md
- **Developed by:** [Suraj Pathak](https://apify.com/suraj_pp) (community)
- **Categories:** E-commerce
- **Stats:** 2 total users, 0 monthly users, 100.0% runs succeeded, NaN 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 Ratings Scraper

A memory-efficient Apify Actor that scrapes product ratings, review counts, and star distribution from Amazon using **CheerioCrawler** (no browser needed).

### Features

- **Low Memory**: Runs on **256 MB** — uses ~4× less memory than browser-based scrapers
- **Low Cost**: ~0.25 CU per 100 products (vs ~1–2 CU with Playwright)
- **Flexible Input**: Accepts ASINs, product URLs, or a mix of both
- **Cross-Marketplace**: Mix `.com` and `.in` URLs (and 18 other domains) in a single run — marketplace is auto-detected from each URL
- **Smart Fallback**: If star distribution isn't found on the product page, automatically tries the reviews page
- **Session Rotation**: Built-in session pool to avoid blocks
- **Error Reporting**: Failed requests are logged in the dataset with error details

### Output Format

Each product produces a JSON object like this:

```json
{
    "asin": "B0BN93GLDN",
    "title": "Apple iPhone 14 Pro Max, 256GB, Deep Purple - Unlocked",
    "url": "https://www.amazon.com/dp/B0BN93GLDN",
    "marketplace": "www.amazon.com",
    "overallRating": 4.6,
    "totalRatingsCount": 12847,
    "starDistribution": {
        "5_star": 76,
        "4_star": 12,
        "3_star": 5,
        "2_star": 3,
        "1_star": 4
    },
    "scrapedAt": "2026-03-22T10:30:00.000Z"
}
````

### Input Examples

#### Using ASINs (uses default marketplace)

```json
{
    "inputs": ["B0BN93GLDN", "B09V3KXJPB", "B0DLHBKTRN"],
    "marketplace": "www.amazon.com"
}
```

#### Using URLs (marketplace auto-detected per URL)

```json
{
    "inputs": [
        "https://www.amazon.com/dp/B0BN93GLDN",
        "https://www.amazon.in/Some-Product/dp/B09V3KXJPB/ref=sr_1_1"
    ]
}
```

In the above example, the first product scrapes from `.com` and the second from `.in` — automatically.

#### Mixed ASINs + URLs from different marketplaces

```json
{
    "inputs": [
        "B0BN93GLDN",
        "https://www.amazon.com/dp/B09V3KXJPB",
        "https://www.amazon.in/dp/B0DJYHM2V7"
    ],
    "marketplace": "www.amazon.com",
    "maxConcurrency": 5
}
```

Here, `B0BN93GLDN` (plain ASIN) uses the fallback marketplace `.com`, while the two URLs each use their own detected domain.

### Cost Estimation

| Products | Memory | Approx. Time | Approx. Cost (CU) |
|----------|--------|-------------- |--------------------|
| 10       | 256 MB | ~1 min        | ~0.004             |
| 100      | 256 MB | ~5 min        | ~0.02              |
| 1,000    | 256 MB | ~40 min       | ~0.17              |

*Costs exclude proxy usage. Residential proxies are recommended for Amazon.*

### Local Development

```bash
## Install dependencies
npm install

## Create input file
mkdir -p storage/key_value_stores/default
echo '{"inputs":["B0BN93GLDN"],"marketplace":"www.amazon.com"}' > storage/key_value_stores/default/INPUT.json

## Run locally (without proxy — may get blocked)
npm start
```

### Deploying to Apify

```bash
## Install Apify CLI
npm install -g apify-cli

## Login
apify login

## Push to Apify platform
apify push
```

### Tips for Best Results

1. **Use Residential Proxies** — Amazon aggressively blocks datacenter IPs
2. **Keep concurrency low** (3–5) — saves memory and reduces block rate
3. **Set marketplace correctly** — Amazon shows different data per region
4. **Run during off-peak hours** — lower chance of CAPTCHAs

# Actor input Schema

## `inputs` (type: `array`):

List of Amazon ASINs (e.g. B0BN93GLDN) or full product URLs from any Amazon domain (.com, .in, .co.uk, etc). You can mix ASINs and URLs from different marketplaces — the domain is auto-detected from each URL. Plain ASINs use the 'marketplace' setting below as fallback.

## `marketplace` (type: `string`):

Default marketplace used only for plain ASINs. When you provide a full URL (e.g. amazon.in/dp/...), the marketplace is auto-detected from the URL domain.

## `maxConcurrency` (type: `integer`):

Maximum number of concurrent requests. Lower values use less memory.

## `proxyConfig` (type: `object`):

Proxy settings. Residential proxies recommended for Amazon.

## Actor input object example

```json
{
  "inputs": [
    "B0BN93GLDN",
    "https://www.amazon.com/dp/B09V3KXJPB",
    "https://www.amazon.in/dp/B0DJYHM2V7"
  ],
  "marketplace": "www.amazon.com",
  "maxConcurrency": 3,
  "proxyConfig": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# 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 = {
    "inputs": [
        "B0BN93GLDN",
        "https://www.amazon.com/dp/B09V3KXJPB",
        "https://www.amazon.in/dp/B0DJYHM2V7"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("suraj_pp/amazon-ratings-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 = { "inputs": [
        "B0BN93GLDN",
        "https://www.amazon.com/dp/B09V3KXJPB",
        "https://www.amazon.in/dp/B0DJYHM2V7",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("suraj_pp/amazon-ratings-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 '{
  "inputs": [
    "B0BN93GLDN",
    "https://www.amazon.com/dp/B09V3KXJPB",
    "https://www.amazon.in/dp/B0DJYHM2V7"
  ]
}' |
apify call suraj_pp/amazon-ratings-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Amazon Ratings Scraper",
        "description": "This is the scraper built to scrap 1000+ product ratings, ratings count, stars percentage.",
        "version": "0.0",
        "x-build-id": "KoQCHWhfWHBWL5in4"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/suraj_pp~amazon-ratings-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-suraj_pp-amazon-ratings-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/suraj_pp~amazon-ratings-scraper/runs": {
            "post": {
                "operationId": "runs-sync-suraj_pp-amazon-ratings-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/suraj_pp~amazon-ratings-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-suraj_pp-amazon-ratings-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": [
                    "inputs"
                ],
                "properties": {
                    "inputs": {
                        "title": "ASINs or Product URLs",
                        "type": "array",
                        "description": "List of Amazon ASINs (e.g. B0BN93GLDN) or full product URLs from any Amazon domain (.com, .in, .co.uk, etc). You can mix ASINs and URLs from different marketplaces — the domain is auto-detected from each URL. Plain ASINs use the 'marketplace' setting below as fallback.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "marketplace": {
                        "title": "Amazon Marketplace",
                        "enum": [
                            "www.amazon.com",
                            "www.amazon.co.uk",
                            "www.amazon.de",
                            "www.amazon.fr",
                            "www.amazon.it",
                            "www.amazon.es",
                            "www.amazon.in",
                            "www.amazon.co.jp",
                            "www.amazon.ca",
                            "www.amazon.com.au",
                            "www.amazon.com.br",
                            "www.amazon.com.mx",
                            "www.amazon.sg",
                            "www.amazon.ae",
                            "www.amazon.sa"
                        ],
                        "type": "string",
                        "description": "Default marketplace used only for plain ASINs. When you provide a full URL (e.g. amazon.in/dp/...), the marketplace is auto-detected from the URL domain.",
                        "default": "www.amazon.com"
                    },
                    "maxConcurrency": {
                        "title": "Max Concurrency",
                        "minimum": 1,
                        "maximum": 10,
                        "type": "integer",
                        "description": "Maximum number of concurrent requests. Lower values use less memory.",
                        "default": 3
                    },
                    "proxyConfig": {
                        "title": "Proxy Configuration",
                        "type": "object",
                        "description": "Proxy settings. Residential proxies recommended for Amazon.",
                        "default": {
                            "useApifyProxy": true,
                            "apifyProxyGroups": [
                                "RESIDENTIAL"
                            ]
                        }
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
