DEV Community

voiddo
voiddo

Posted on Originally published at voidd0.github.io

Amazon Product Details Scraper: how to get ASIN, Price, Sales Rank as JSON or CSV (Python, API, no code)

Scrape Amazon.com product pages from ASINs or links: title, brand, price, list price, rating, ratings count, stock status, features, description, images, categories, best sellers rank, variations and product details.

This tutorial shows what the Actor v0iddo/amazon-product-scraper returns, how to run it on the Apify Store without code, and how to call it from Python and cURL.

What data you get

One row per result. Every row can be downloaded as JSON, CSV, Excel or HTML, or read through the API.

Field Label Type Example
asin ASIN text B09B8V1LZ3
title Title text Amazon Echo Dot (newest model) - Vibrant sounding speaker, Designed...
brand Brand text Amazon
price Price number 79.99
listPrice List price number
rating Stars number 4.7
ratingsCount Ratings number 201463
inStock In stock true/false true
mainImage Image image URL https://m.media-amazon.com/images/I/61J2sQtBYDL._AC_SL1500_.jpg
url Product URL URL https://www.amazon.com/dp/B09B8V1LZ3
currency currency text USD
availability availability text In Stock
description description text Enhance your smart home hub experience with the Charcoal colored 20...
images images list ["https://m.media-amazon.com/images/I/61J2sQtBYDL._AC_SL1500_.jpg",...
variationsCount variationsCount number 6
variationAsins variationAsins list ["B09B8V1LZ3", "B0HKL4CT1J", "B09B94RL1R"]

Real rows from a run of the Actor (fields that name people are left out):

[
  {
    "asin": "B09B8V1LZ3",
    "url": "https://www.amazon.com/dp/B09B8V1LZ3",
    "title": "Amazon Echo Dot (newest model) - Vibrant sounding speaker, Designed for Alexa+, Great for bedrooms, dining rooms and offices, Charcoal",
    "brand": "Amazon",
    "price": 79.99,
    "currency": "USD",
    "rating": 4.7,
    "ratingsCount": 201463,
    "availability": "In Stock",
    "inStock": true,
    "description": "Enhance your smart home hub experience with the Charcoal colored 2022 Echo Dot 5th generation smart speaker featuring Alexa capabilities...",
    "images": [
      "https://m.media-amazon.com/images/I/61J2sQtBYDL._AC_SL1500_.jpg",
      "https://m.media-amazon.com/images/I/71hNp8d9WvL._AC_SL1500_.jpg",
      "https://m.media-amazon.com/images/I/71kDL97LTgL._AC_SL1500_.jpg"
    ],
    "mainImage": "https://m.media-amazon.com/images/I/61J2sQtBYDL._AC_SL1500_.jpg",
    "variationsCount": 6,
    "variationAsins": [
      "B09B8V1LZ3",
      "B0HKL4CT1J",
      "B09B94RL1R"
    ]
  },
  {
    "asin": "0735211299",
    "url": "https://www.amazon.com/dp/0735211299",
    "title": "Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones",
    "price": 8.55,
    "currency": "USD",
    "listPrice": 27,
    "rating": 4.8,
    "ratingsCount": 150297,
    "availability": "Only 1 left in stock - order soon.",
    "inStock": true,
    "description": "The #1 New York Times bestseller. Over 25 million copies sold! Translated into 60+ languages! Tiny Changes, Remarkable Results No matter...",
    "images": [
      "https://m.media-amazon.com/images/I/8106lPWfXpL._SL1500_.jpg"
    ],
    "mainImage": "https://m.media-amazon.com/images/I/8106lPWfXpL._SL1500_.jpg",
    "categories": [
      "Books",
      "Health, Fitness & Dieting",
      "Psychology & Counseling"
    ],
    "dimensions": "6.36 x 1.11 x 9.27 inches",
    "weight": "1.13 pounds",
    "specifications": {
      "Publisher": "Avery",
      "Publication date": "October 16, 2018",
      "Edition": "First Edition",
      "Language": "English",
      "Print length": "320 pages",
      "ISBN-10": "0735211299",
      "ISBN-13": "978-0735211292",
      "Item Weight": "1.13 pounds",
      "Dimensions": "6.36 x 1.11 x 9.27 inches"
    }
  }
]
Enter fullscreen mode Exit fullscreen mode

No code: run it on the Apify Store

  1. Open the Amazon Product Details Scraper page on Apify.
  2. Fill in the input form. An example input is already filled in.
  3. Press Start, wait for the run to finish, and download the results as JSON, CSV or Excel from the Output tab.

The input that is pre-filled on the Actor page:

{
  "products": [
    "B09B8V1LZ3",
    "0735211299",
    "B00FLYWNYQ",
    "B09HM94VDS",
    "B0CFPJYX7P",
    "B0BP9SNVH9"
  ],
  "maxItems": 20
}
Enter fullscreen mode Exit fullscreen mode

Python (apify-client)

Get your API token in Apify Console under Settings, then Integrations. The Actor id is v0iddo/amazon-product-scraper.

from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_TOKEN")

run_input = {'products': ['B09B8V1LZ3',
              '0735211299',
              'B00FLYWNYQ',
              'B09HM94VDS',
              'B0CFPJYX7P',
              'B0BP9SNVH9'],
 'maxItems': 20}

run = client.actor("v0iddo/amazon-product-scraper").call(run_input=run_input)
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)
Enter fullscreen mode Exit fullscreen mode

cURL

curl -X POST "https://api.apify.com/v2/acts/v0iddo~amazon-product-scraper/run-sync-get-dataset-items" \
  -H "Authorization: Bearer YOUR_APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"products": ["B09B8V1LZ3", "0735211299", "B00FLYWNYQ", "B09HM94VDS", "B0CFPJYX7P", "B0BP9SNVH9"], "maxItems": 20}'
Enter fullscreen mode Exit fullscreen mode

Good to know

  • Covers amazon.com (United States). One row per product, at most 1000 products per run. Each product is one page request of about 2 MB, so large lists take a while.
  • Prices, stock and shipping are what amazon.com shows to a visitor without an account in the United States. When a product shows several offers, the price of the main offer is used.
  • Seller names, customer reviews and book author names are not collected.

Price

$1.50 per 1,000 results. You pay per result row. There is no separate charge per run. Higher Apify plans pay less per result, down to $1.05 per 1,000.

FAQ

What data does the Amazon Product Details Scraper return?

Each result is one row in an Apify dataset. Fields include asin, title, brand, price, listPrice, rating, ratingsCount, inStock, and more. The table above shows every field with an example value.

Can I use it without writing code?

Yes. Open the Actor page on Apify, fill in the input form (an example is already filled in), press Start, and download the results as JSON, CSV, Excel or HTML. You can also schedule runs there.

How much does it cost?

$1.50 per 1,000 results. You pay per result row. There is no separate charge per run. Higher Apify plans pay less per result, down to $1.05 per 1,000. A new Apify account gets $5 of platform credit every month.

Links

Top comments (0)