# Amazon Product Scrapper (`happitap/amazon-product-scrapper`) Actor

Amazon Product Scraper - extracts product details from Amazon product pages, search results, and category pages with structured data including title, ASIN, price, ratings, reviews, availability, seller, and more.

- **URL**: https://apify.com/happitap/amazon-product-scrapper.md
- **Developed by:** [HappiTap](https://apify.com/happitap) (community)
- **Categories:** E-commerce, Automation, Developer tools
- **Stats:** 200 total users, 1 monthly users, 0.0% runs succeeded, 2 bookmarks
- **User rating**: 2.90 out of 5 stars

## Pricing

from $2.00 / 1,000 product scrapeds

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 Scraper

An Apify actor that extracts product details from Amazon product pages, search results, and category pages with comprehensive structured data including availability, seller information, and more.

### What It Does

This scraper extracts structured data from various Amazon pages including:

| Field | Description |
|-------|-------------|
| `title` | Product name/title |
| `asin` | Amazon Standard Identification Number |
| `price` | Current product price |
| `rating` | Average user rating (e.g., 4.5) |
| `reviewCount` | Total number of user reviews |
| `availability` | In stock / out of stock status |
| `seller` | Sold by (seller name) |
| `category` | Main category or breadcrumb |
| `url` | Direct product URL on Amazon |
| `imageUrl` | Product image thumbnail |

### Supported Page Types

- **Product Pages**: Individual product detail pages (e.g., `/dp/B08J8KJ9T3`)
- **Search Results**: Search query results (e.g., `/s?k=wireless+earbuds`)
- **Category Pages**: Category browsing pages (e.g., `/Best-Sellers-Electronics`)
- **Best Sellers**: Best sellers pages (e.g., `/Best-Sellers/zgbs`)

### Use Cases

- **Product Research**: Extract detailed product information for market analysis
- **Price Monitoring**: Track product prices and availability across categories
- **Competitor Analysis**: Monitor competitor products and pricing strategies
- **Inventory Tracking**: Check product availability and seller information
- **E-commerce Data Collection**: Gather comprehensive product catalogs

### Input

The actor accepts the following input format:

```json
{
  "startUrls": [
    { "url": "https://www.amazon.com/s?k=wireless+earbuds" }
  ],
  "maxItems": 50
}
```

#### Input Parameters

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| `startUrls` | Array | Yes | - | Array of objects with `url` property pointing to Amazon pages |
| `maxItems` | Number | No | `50` | Maximum number of products to extract per page |

#### Supported Amazon URLs

The scraper works with various Amazon page types:

**Product Pages:**

- `https://www.amazon.com/dp/B08J8KJ9T3`
- `https://www.amazon.com/gp/product/B08J8KJ9T3`

**Search Results:**

- `https://www.amazon.com/s?k=wireless+earbuds`
- `https://www.amazon.com/s?k=laptop&ref=sr_pg_1`

**Category Pages:**

- `https://www.amazon.com/Best-Sellers-Electronics/zgbs/electronics`
- `https://www.amazon.com/Best-Sellers/zgbs`

### Output

The actor outputs structured data for each product found:

```json
{
  "title": "Apple AirPods (3rd Generation)",
  "asin": "B08J8KJ9T3",
  "price": "$169.00",
  "rating": 4.7,
  "reviewCount": 15600,
  "availability": "In Stock",
  "seller": "Amazon.com Services LLC",
  "category": "Electronics > Headphones",
  "url": "https://www.amazon.com/dp/B08J8KJ9T3",
  "imageUrl": "https://m.media-amazon.com/images/I/61SUj2aKoEL._AC_UL320_.jpg",
  "scrapedAt": "2024-01-01T00:00:00.000Z"
}
```

### Example Usage

#### Search for Wireless Earbuds

```json
{
  "startUrls": [
    { "url": "https://www.amazon.com/s?k=wireless+earbuds" }
  ],
  "maxItems": 50
}
```

#### Extract from Product Page

```json
{
  "startUrls": [
    { "url": "https://www.amazon.com/dp/B08J8KJ9T3" }
  ],
  "maxItems": 1
}
```

#### Multiple Sources

```json
{
  "startUrls": [
    { "url": "https://www.amazon.com/s?k=laptop" },
    { "url": "https://www.amazon.com/Best-Sellers-Electronics/zgbs/electronics" }
  ],
  "maxItems": 25
}
```

### How It Works

1. **Page Type Detection**: Automatically detects whether the URL is a product page, search results, or category page
2. **Appropriate Handler**: Routes to the correct scraping handler based on page type
3. **Data Extraction**: Uses specialized selectors for each page type to extract product information
4. **Comprehensive Fields**: Extracts all required fields including availability and seller information
5. **Data Validation**: Ensures only products with valid ASINs and titles are included
6. **Structured Output**: Returns clean, structured data ready for analysis

### Features

- **Multi-Page Support**: Handles product pages, search results, and category pages
- **Robust Extraction**: Multiple fallback selectors to handle Amazon's changing page structure
- **Stealth Mode**: Uses Puppeteer with stealth plugins to avoid detection
- **Proxy Support**: Built-in proxy rotation for reliable scraping
- **Error Handling**: Graceful error handling with detailed logging
- **Data Validation**: Ensures data quality with validation checks
- **Availability Tracking**: Extracts stock status and seller information

### Notes

- The scraper is designed to be respectful of Amazon's servers and includes appropriate delays
- Results may vary based on Amazon's page structure changes
- The scraper automatically handles different Amazon page layouts and product formats
- All extracted data is timestamped for tracking purposes
- Product pages return single items, while search/category pages return multiple products

# Actor input Schema

## `startUrls` (type: `array`):

List of Amazon.com URLs to scrape product data from. Supports multiple URL types: (1) Product detail pages (e.g., https://www.amazon.com/dp/B09B8V1LZ3), (2) Search result pages (e.g., https://www.amazon.com/s?k=wireless+earbuds), (3) Category/Best Seller pages (e.g., https://www.amazon.com/Best-Sellers-Electronics). Each URL must be from amazon.com domain. The scraper will automatically detect the page type and extract all available product information including title, ASIN, price, ratings, reviews, availability, seller details, and images. For search and category pages, it will extract all products visible on the page up to the maxItems limit.

## `maxItems` (type: `integer`):

Maximum number of products to extract from each URL. This limit applies per URL, not total across all URLs. For example, if you provide 3 search URLs with maxItems set to 50, you could get up to 150 products total (50 from each URL). For product detail pages, this setting is ignored since each page contains only one product. Recommended values: 10-50 for testing, 100-500 for production runs. Higher values will increase runtime and costs. Note: With pay-per-event pricing, you are charged $0.002 per product scraped, so setting this appropriately helps control costs.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://www.amazon.com/s?k=wireless+earbuds"
    }
  ],
  "maxItems": 50
}
```

# Actor output Schema

## `overview` (type: `string`):

Quick overview of all scraped products with essential information

## `detailed` (type: `string`):

Complete product information including images and timestamps

## `inStock` (type: `string`):

Filter to show only products currently available in stock

## `highRated` (type: `string`):

Filter to show only highly rated products (4 stars and above)

## `allResults` (type: `string`):

Complete dataset with all fields in JSON format

# 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 = {
    "startUrls": [
        {
            "url": "https://www.amazon.com/s?k=wireless+earbuds"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("happitap/amazon-product-scrapper").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 = { "startUrls": [{ "url": "https://www.amazon.com/s?k=wireless+earbuds" }] }

# Run the Actor and wait for it to finish
run = client.actor("happitap/amazon-product-scrapper").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 '{
  "startUrls": [
    {
      "url": "https://www.amazon.com/s?k=wireless+earbuds"
    }
  ]
}' |
apify call happitap/amazon-product-scrapper --silent --output-dataset

```

## MCP server setup

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

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/MAvVExUY8ZJuDZ8bj/builds/Boin64ufXnd2rH4p5/openapi.json
