# Amazon Product Details Scraper (`tpp/amazon-product-details-scraper`) Actor

Amazon Product Details Scraper is your essential tool for accessing deep, detailed data from Amazon product pages. Designed to serve the needs of data analysts, market researchers, and e-commerce professionals, this scraper efficiently extracts critical information.

- **URL**: https://apify.com/tpp/amazon-product-details-scraper.md
- **Developed by:** [TPP](https://apify.com/tpp) (community)
- **Categories:** E-commerce, Automation, SEO tools
- **Stats:** 182 total users, 1 monthly users, 100.0% runs succeeded, 5 bookmarks
- **User rating**: No ratings yet

## Pricing

$25.00/month + usage

To use this Actor, you pay a monthly rental fee to the developer. The rent is subtracted from your prepaid usage every month after the free trial period.You also pay for the Apify platform usage, which gets cheaper the higher Apify subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#rental-actors

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — 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

## Custom Amazon Product Scraper

### What does Custom Amazon Product Scraper do?

Custom Amazon Product Scraper enables you to extract comprehensive data from Amazon beyond what is available through the official Amazon API. This scraper can gather the following product details:

- Product names
- Prices
- Ratings
- Number of reviews
- Product descriptions
- Brand details
- Features
- Variations
- Seller name
- Discounts and offers
- Breadcrumbs
- Delivery details
- Images and videos
- Additional product information
- What’s in The Box
- ASIN
- A+ Content

### Why scrape Amazon?

Amazon, with its vast user base, serves as a valuable data source for e-commerce insights and market analysis. Here are key use cases for utilizing Amazon data:

- Analyzing pricing trends
- Monitoring product reviews
- Conducting competitor research
- Generating product catalogs

For more insights on leveraging Amazon scraping for your business, visit our [e-commerce industry page](https://apify.com/industries).

### How to scrape Amazon

Scraping Amazon with Custom Amazon Product Scraper is straightforward. Follow these steps to obtain your desired data within minutes:

1. Click on "Try for free."
2. Enter the keywords or product URLs you want to scrape.
3. Click on "Run."
4. Access your data from the Dataset tab once Custom Amazon Product Scraper has finished.

### Tips for scraping Amazon

- Use specific search terms or product URLs to target your desired products efficiently.
- Implement retry mechanisms to handle occasional scraping issues and ensure robust data extraction.

### Is it legal to scrape Amazon?

When scraping Amazon or any website, always adhere to data usage policies and legal considerations, especially regarding personal data. Consult legal experts if needed to ensure compliance with applicable laws and regulations.

### How it Works

This Python script operates as follows:

- **Input Data Specification:**
  - The actor reads input data provided to the instance, which includes the following key parameter:

  - ***`start_urls`***

  - Description: This is a list of URLs from which the actor will initiate scraping. Each URL should direct to a specific Amazon product page.

  - Requirement: Required.

  - Format: List of fully qualified URLs.

  - Domain Flexibility: The actor can process URLs from any Amazon regional website (e.g., Amazon.com, Amazon.de, Amazon.co.uk, etc.).

  - ***Example***
    - ````json
      {
        "start_urls": [
          "https://www.amazon.in/dp/B0BXX8LMBV",  // Example for Amazon India
          "https://www.amazon.de/dp/B0CQPGCCLZ"   // Example for Amazon Germany
        ]
      }```   

      ````

- **Request Queue Management:**
  - Initialization of a request queue (`queue`) with the starting URLs and their respective depths set to 0.

- **Processing Requests:**
  - Iteratively processes requests in the queue:
    - Fetches the URL content using HTTPX.
    - Parses the HTML content using BeautifulSoup.

- **Semaphore-based Batching for Parallel Processing:**
  - Implements a semaphore (`asyncio.Semaphore`) to create batches of URLs and execute them in parallel:
    - Limits concurrency to 10 requests at a time (`semaphore = asyncio.Semaphore(10)`).
    - Ensures efficient utilization of resources by running multiple requests simultaneously.

- **Retry Mechanism for Robust Data Extraction:**
  - Implements a retry mechanism (`MAX_RETRIES`) within the `process_url` function to handle failed scraping attempts:
    - If an exception occurs during URL processing, the script retries the request up to 5 times (`MAX_RETRIES`) before logging an error message.

- **Data Extraction and Storage:**
  - Extracts desired data (e.g., product information) from the processed web pages.
  - Stores extracted data into a default dataset using the `http.push_data` method of the Actor instance.

### How much will it cost to scrape Amazon?

Apify offers $5 free usage credits monthly on the [Apify Free plan](https://apify.com/pricing). With Custom Amazon Product Scraper, you can take advantage of our free trial to test the scraper for your needs.

- Consider our $25/month subscription once you’re satisfied with the output from the free trial.

### Results

Example of JSON results with detailed product data:

````json
{
  "asin": "B01LYEV6RF",
  "url": "https://www.amazon.in/Quaker-Oats-2kg/dp/B01LYEV6RF/ref=zg_bs_g_grocery_d_sccl_24/257-3121423-6111158?psc=1",
  "title": "Quaker Oats 2kg | Rolled Oats | 100% Natural Wholegrain | Nutritious Breakfast Cereals | Porridge | Easy to Cook : Amazon.in: Books",
  "productImage": "https://m.media-amazon.com/images/I/61SHF0RYZDL.jpg",
  "productName": null,
  "description": null,
  "productInformation": {},
  "brandDetails": [],
  "features": [],
  "variations_1": [],
  "variations_2": [],
  "variations_3": [],
  "variations_4": [],
  "variations_5": [],
  "seller": null,
  "price": null,
  "MRP": "₹440",
  "star": "4.5 out of 5 stars",
  "review": "38,700 ratings",
  "brand": null,
  "offers": "Super Value Days: 10% Instant Discount up to INR 300 on ICICI Bank Credit Cards (excluding Amazon Pay ICICI Credit Card). Minimum Trxn is ₹2,500\nGet GST  invoice and save up to 28% on business purchases.Sign up for free",
  "breadcrumbs": "Grocery & Gourmet Foods › Breakfast Cereal › Cold Cereal",
  "delivery": "FREE delivery Wednesday, 3 April on orders dispatched by Amazon over ₹499. Details\nFREE delivery\nWednesday, 3 April\nDetails",
  "whatsInTheBox": null,
  "productBadge": "",
  "allImages": [
    "https://m.media-amazon.com/images/I/61SHF0RYZDL.jpg",
    "https://m.media-amazon.com/images/I/71l-dpxk+oL._SL1500_.jpg",
    "https://m.media-amazon.com/images/I/71l-dpxk+oL._SL1500_.jpg",
    "https://m.media-amazon.com/images/I/51goG9fpsgL._SL1500_.jpg",
    "https://m.media-amazon.com/images/I/81Faow1r0nL._SL1500_.jpg",
    "https://m.media-amazon.com/images/I/71nPpNOomsL._SL1500_.jpg",
    "https://m.media-amazon.com/images/I/71Ecc6iPDeL._SL1500_.jpg",
    "https://m.media-amazon.com/images/I/71YmOjJJApL._SL1500_.jpg"
  ],
  "allVideos": [],
  "aPlusMainImages": [
    "https://m.media-amazon.com/images/S/aplus-media-library-service-media/5889e345-f262-4cf2-89f5-f3af7b9337b1.__CR0,0,970,600_PT0_SX970_V1___.jpg",
    "https://m.media-amazon.com/images/S/aplus-media-library-service-media/69b36cdc-3b5a-43de-bf9a-268a9f02c136.__CR0,0,970,600_PT0_SX970_V1___.jpg"
  ],
  "aPlusMainText": [],
  "aPlusImages": [
    "https://m.media-amazon.com/images/S/aplus-media-library-service-media/76b66952-f916-4c18-8be9-363c9037977b.__CR0,0,300,600_PT0_SX150_V1___.jpg",
    "https://m.media-amazon.com/images/S/aplus-media-library-service-media/6da64bbd-1b90-4634-b51e-528951a78c37.__CR0,0,300,600_PT0_SX150_V1___.jpg",
    "https://m.media-amazon.com/images/S/aplus-media-library-service-media/1904aba3-8d8d-4117-8004-ee3c4222baa9.__CR0,0,300,600_PT0_SX150_V1___.jpg",
    "https://m.media-amazon.com/images/S/aplus-media-library-service-media/ac239dcf-a46a-4a7a-b7d6-f81baa66e879.__CR0,0,300,600_PT0_SX150_V1___.jpg",
    "https://m.media-amazon.com/images/S/aplus-media-library-service-media/c7304809-16b7-42fe-9c4f-a181b51733f6.__CR0,0,300,600_PT0_SX150_V1___.jpg"
  ],
  "aPlusParagraph": [],
  "aPlusHeadings": [],
  "hello": "world"
}

# Actor input Schema

## `start_urls` (type: `array`):

URLs to start with

## Actor input object example

```json
{
  "start_urls": [
    {
      "url": "https://www.amazon.in/dp/B0BXX8LMBV"
    }
  ]
}
````

# 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 = {
    "start_urls": [
        {
            "url": "https://www.amazon.in/dp/B0BXX8LMBV"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("tpp/amazon-product-details-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 = { "start_urls": [{ "url": "https://www.amazon.in/dp/B0BXX8LMBV" }] }

# Run the Actor and wait for it to finish
run = client.actor("tpp/amazon-product-details-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 '{
  "start_urls": [
    {
      "url": "https://www.amazon.in/dp/B0BXX8LMBV"
    }
  ]
}' |
apify call tpp/amazon-product-details-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/acts/VW5vb9LnaNwRSqdLS/builds/J4PrWTaF4G3YxXcij/openapi.json
