Amazon Scraper — Search Results, Best Sellers and Reviews in Python
Amazon scraper — an open-source (MIT) Python tool that reads Amazon search results, best-seller grids, product pages and the reviews shown to visitors with no account, on any of its 21 marketplaces, and writes them to JSON or CSV. Measured on 2026-09-08 from a residential exit IP in Europe with a plain local Chromium, a three-page search ran with no API key, no proxy and no account. Use it to build a product dataset, monitor prices, or compare two runs with diff_runs.py.
Scrapes Amazon search results, best-seller grids, product pages and the
reviews Amazon shows to visitors with no account — on any of its 21
marketplaces. JSON or CSV, one row schema per mode, and a run-metadata
sidecar that says whether the result is complete.
Four engines: Playwright (primary), Selenium, pyppeteer, or a
remote browser over CDP such as the Scraping Browser API.
What works with nothing at all
The most useful thing this README can tell you is where the paid path is
unnecessary. Measured on 2026-09-08, from a residential exit IP in
Europe, with a plain local Chromium — no API key, no proxy, no account:
$ python3 playwright_scraper.py \
--url "https://www.amazon.com/s?k=bluetooth+headphones&i=electronics" \
--pages 3
Parsed 30 rows from page 1. Price coverage on page 1: 24/30 (80%).
Parsed 30 rows from page 2. Price coverage on page 2: 22/30 (73%).
Parsed 30 rows from page 3. Price coverage on page 3: 25/30 (83%).
Saved 77 products -> amazon_products.json # 90 rows, 13 duplicates dropped
Wrote run metadata -> amazon_products.meta.json (status=complete)
$ echo $?
0
Amazon's front door met that run twice and neither time cost anything: an
AWS WAF JavaScript challenge, which a real browser solves by itself
(measured: 3.9 s on amazon.co.uk), and a 503 throttle on amazon.de, which
a retry cleared.
So what do the 2Captcha products actually buy here?
| Product |
What it is for on Amazon |
Proxies (--proxy-file) |
Volume. One address doing 50 pages an hour gets scored; twenty doing five each do not. Also the only way to choose an exit country. |
Scraping Browser API (--cdp-endpoint) |
A browser you do not run or patch, with a persistent profile and a chosen exit country. Also Captcha.setAutoSolve inside the browser. |
Captcha solving (--twocaptcha-key) |
One page: Amazon's own image captcha, "Enter the characters you see below". Not the WAF challenge, not a 503, not a sign-in wall. |
Fingerprints (--fingerprint) |
A consistent device identity across runs, matched to the exit country. |
Install
git clone https://github.com/2scraper/amazon-scraper
cd amazon-scraper
pip install -r requirements.txt # core: beautifulsoup4, requests
# then ONE engine
pip install -r requirements-playwright.txt && playwright install chromium
# or pip install -r requirements-selenium.txt (needs a local Chrome)
# or pip install -r requirements-puppeteer.txt (downloads its own Chromium)
Install exactly one engine. playwright and pyppeteer declare
mutually unsatisfiable pins (pyee <12 vs ≥13), and pyppeteer and selenium
collide on urllib3 (<2.0 vs ≥2.6). All three do run side by side in
practice, because neither library touches the incompatible part — but
pip check reports the conflict and pip may resolve it by downgrading
something you wanted. Use a virtualenv per engine if you need more than one.
Three modes
# 1. LISTING (default) — search results or a best-seller grid, paginated
python3 playwright_scraper.py --url "https://www.amazon.com/s?k=wireless+headphones" --pages 3
python3 playwright_scraper.py --url "https://www.amazon.com/Best-Sellers-Electronics/zgbs/electronics/" --pages 2
# 2. PRODUCT — one /dp/{ASIN} page: brand, seller, bullets, images, variations
python3 playwright_scraper.py --mode product --url "https://www.amazon.com/dp/B07K5214NZ"
# 3. REVIEWS — the reviews Amazon renders to a visitor with no account
python3 playwright_scraper.py --mode reviews --url "https://www.amazon.com/dp/B07K5214NZ"
The marketplace comes from the URL's hostname. There is no --marketplace
flag, deliberately: one fewer way for a flag and a URL to disagree about
which site a run is reading.
Why --mode reviews has no --pages
/product-reviews/{ASIN} — the paginated review history — redirects to
/ap/signin on page 1, not on page 2. An anonymous visitor cannot read it
at all. What this mode returns is the reviews rendered on the product page
itself: 13 per product in every measurement here, complete with author,
rating, date, verified-purchase flag, helpful votes and body text. There is
no second page to fetch, so there is no flag to ask for one.
If you need the full history, you need an account, and this repo does not go
there: scraping from a logged-in session risks the account, and a canary
could not cover the path.
Output
One row per product, same field order in JSON and CSV. The first sixteen
columns are shared with every other scraper in this family, so a consumer
written against one of them reads these unchanged; Amazon's own columns come
after.
| Column |
Notes |
source |
The marketplace host the row came from: amazon.com, amazon.co.jp, … |
scraped_at |
UTC, ISO 8601 |
url |
Rebuilt as https://www.{host}/dp/{ASIN} — see below |
sku |
The ASIN |
title, brand, price, currency, original_price, discount_pct |
brand is null in listing mode — see the traps |
rating, review_count, in_stock, image_url, category |
|
price_source |
offscreen / split / detail — which node the price was read from |
page, position |
Which listing page, and the position within it. On a best-seller grid position is Amazon's published rank (#1–#50) |
sponsored, badge, coupon |
Sponsored placements are flagged, not dropped |
seller, availability, bullets, images |
--mode product only; null on a listing run |
parent_asin, variation_dimensions, variation_count, selected_variation |
--mode product only. The twister's dimensions as the site labels them, how many variants the site says there are, and which one this row is. See below |
--mode reviews writes a different schema: sku, review_id, title,
rating, author, review_date, verified_purchase, helpful_votes,
variant, variant_asin, body.
See sample_output.json and
sample_output.csv — both cut from a real run, not
written by hand. CI checks their columns against the schema.
In the CSV only, a text cell that begins with =, +, -, @, a tab or
a line break gets a leading apostrophe, so a spreadsheet shows it as text
instead of running it as a formula. Titles, sellers, bullets and review text
are written by third parties. Numbers are never touched and the JSON keeps
the original text; csv_cells_escaped in <out>.meta.json says how many
cells were changed.
Output files are replaced atomically (written to a temporary file beside the
target, then renamed), so a run killed mid-write leaves the previous file
intact rather than a truncated one. File permissions follow your umask, and
an existing file keeps its mode.
The run-metadata sidecar
Every successful run writes <out>.meta.json beside its output:
{
"source": "amazon.com",
"mode": "listing",
"status": "complete",
"stop_reason": "completed",
"pages_requested": 3,
"pages_completed": 3,
"pages_failed": [],
"records": 77,
"record_type": "product",
"products": 77,
"start_url": "https://www.amazon.com/s?k=bluetooth+headphones&i=electronics",
"final_url": "https://www.amazon.com/s?k=bluetooth+headphones&i=electronics&page=3",
"finished_at": "2026-09-08T13:23:23.751597+00:00"
}
status is the field to branch on: complete, partial or failed.
pages_failed names WHICH pages produced nothing, by number — a count stops
being a description once page 3 can fail while 4 and 5 succeed.
records is how many rows were written and record_type says what one row
is — product for --mode listing and --mode product, review for
--mode reviews. Count the reviews, not the products: a reviews run returns
about a dozen rows for ONE ASIN, so "products": 13 was a wrong claim in a
field something might be summing. products is still written, identical to
records, because it has been in every sidecar this project ever wrote —
but it is deprecated, and new consumers should read records.
A failed run writes no <out>.meta.json, because it also does not
overwrite the previous run's output and a "failed" sidecar sitting beside
good data would contradict it. It does write <out>.last_attempt.json,
which carries the same fields for the most recent attempt whether or not it
produced anything — so "the proxy died" and "the search matched nothing" are
distinguishable without clobbering the last good result. That file is
rewritten on every run, successful ones included, so it is never a stale
relic of an old failure.
Variations
A --mode product row carries four variation columns, read from the detail
page's own variation state rather than from the rendered size/colour picker:
| Column |
Example (/dp/B08KTZ8249, 2026-09-21) |
parent_asin |
B09F7TGV1H |
variation_dimensions |
Option, Digital Storage Capacity, Offer Type, Color |
variation_count |
9 |
selected_variation |
Option: Without Kindle Unlimited, Digital Storage Capacity: 8 GB, Offer Type: Lockscreen Ad-Supported, Color: Black |
variation_count is the number the page itself states, not a count of
what was extracted — so the two can be compared, and the parser warns when
they disagree instead of quietly reporting fewer variants than exist.
Why these four and not the whole variant table. One measured product,
the Crocs Classic Clog (/dp/B0014C2NBC, 2026-09-21), publishes 776
variants over Size and Color. A column holding 776 objects is not something
a CSV consumer can use, and dividing it across four scalars loses nothing a
row needs: the identity of this variant, what it varies over, and how much
more there is. Reading every variant is a different job from reading a
product.
The column that used to be here. variations read the rendered twister
(#twister .a-button-text, #twisterContainer .a-button-text) and was null
on every row of every run. Measured on three live /dp/ pages on
2026-09-21 — AirPods Pro 2, the Crocs clog and the Kindle Paperwhite — both
of those selectors matched zero elements on all three. The container
that replaced them, #twister-plus-inline-twister, is present but is an
empty mount point in the served HTML (three descendant elements, no <li>,
no .a-button-text on the AirPods page), so it is only populated after the
page's own JavaScript runs. The state object is in the served bytes either
way, which is why it is what gets read.
Exit codes
| Code |
Meaning |
| 0 |
Rows written |
| 1 |
Crash |
| 2 |
Bad usage (including a credentialed --cdp-endpoint given to Selenium) |
| 3 |
Blocked before parsing: Amazon's image captcha, an unresolved throttle, or a sign-in wall |
| 4 |
Ran fine, found nothing |
| 5 |
The page was never fetched: a navigation timeout, a dead or unauthenticated proxy, a Scraper API error, or a URL Amazon says does not exist (HTTP 404, stop_reason: not_found). Not an empty result — nothing can be concluded about the catalogue |
| 6 |
Partial: some pages gathered, then the run stopped early |
Exit 3 covers the sign-in wall as well as a captcha, because the family's
codes have one slot for "something stood between the run and the content".
The sidecar's stop_reason (needs_signin vs blocked_amazon-captcha)
keeps them apart for anyone who needs to know which it was.
A run that finds nothing writes nothing
By default, zero rows means no file is written and the exit code is 4 — unless the page was never fetched at all, which is exit 5. Either way <out>.last_attempt.json is written with the status and the stop reason, so a failed run is readable without overwriting the last good <out>.meta.json.
That is deliberate: a page-load failure that writes [] over last night's
good output destroys the last known good data, and a consumer cannot tell an
empty result from a failed run. Pass --allow-empty when an empty result is
genuinely the answer you want recorded.
Marketplaces
All 21, selected by the URL you pass: