DEV Community

coreclaw
coreclaw

Posted on

Amazon Global Product Scraper: How to Compare Prices Across Marketplaces with Python

Amazon Global Product Scraper: How to Compare Prices Across Marketplaces with Python

An Amazon Global Product Scraper lets you pull the same product record from several Amazon country marketplaces so you can compare what a shopper actually pays in each one. The hard part is not the download — it is the normalization: each marketplace quotes a different currency, some show tax-inclusive prices and some do not, the Buy Box rotates between sellers, and the same product does not always carry the same ASIN everywhere. This guide builds a Python workflow that collects one record per (marketplace, product), converts to a single reporting currency, matches products across catalogs, and produces a parity index you can defend in a pricing meeting. It is for e-commerce operators, brand pricing managers, and the developers building their data layer.

TL;DR

  • A raw price list per marketplace is not a comparison. Currency, tax display, seller mix, and catalog matching must be normalized before two numbers mean the same thing.
  • Collect by explicit (marketplace, ASIN) pairs and store the raw record beside the normalized one, so every derived number traces back to a source snapshot.
  • Match products in tiers: ASIN first, then brand plus GTIN/model, then a guarded title check. Never let a fuzzy match overwrite a verified one.
  • Report a parity index against a base marketplace plus the spread. Flag only gaps that survive currency conversion and tax treatment.
  • Respect marketplace terms, keep request volumes modest, and never use competitor price data to coordinate pricing.

Why Cross-Marketplace Price Comparison Is Harder Than It Looks

The naive version is a spreadsheet with one column per country. It fails in five ways, and each produces a wrong decision rather than a missing one.

Tax display conventions differ. A US listing typically shows a pre-tax price because sales tax is added at checkout and varies by state, while a German or British listing usually shows a VAT-inclusive price. Compare the raw numbers and you will conclude the European shopper pays far more, when much of the gap is tax the seller remits. State whether your model compares gross or net.

Currency is not a constant. Rates move daily. Convert January prices at a November rate and your trend line measures the currency, not the catalog. Store the rate and its date with every converted value.

The Buy Box is a rotating offer, not a product attribute. Two requests minutes apart can return different sellers at different prices for the same ASIN. That is normal marketplace behavior: one snapshot is a sample, not a definitive price.

Catalog identity is fragmented. Amazon assigns ASINs per marketplace. The same product often shares an ASIN across several European marketplaces and often does not across the US, Japan, and newer marketplaces. Where it differs you need a second identifier: GTIN/EAN, brand plus model, or a reviewed title match.

Assortment and offer type differ. A product may be sold by Amazon retail in one country and a third-party seller in another, and be unavailable in a third. An unavailable listing is not a cheap listing; treating a missing price as zero corrupts every average.

The Data Layer: What You Need to Capture

Define the record before you write the collector. The field names below are the ones this workflow expects; map them to whatever your worker returns, and keep that mapping in one place.

Field Why it matters for parity work
marketplace The country or locale code. Every downstream comparison groups on this.
asin Product identifier within that marketplace. Primary match key.
title, brand Fallback matching when ASINs differ across catalogs.
price, currency The displayed price and its currency code. Never store a price without the currency.
tax_basis Whether the displayed price includes tax. Record it per marketplace, not per product.
seller, fulfillment Buy Box owner and whether it is marketplace-fulfilled. Explains many legitimate gaps.
availability In stock, limited, unavailable. Excludes records from parity math instead of imputing zero.
rating, review_count Context for demand, not for price. Useful when a gap needs a commercial explanation.
captured_at UTC timestamp of the snapshot. Required for any trend claim.

Two storage rules pay for themselves immediately: keep the raw JSON payload next to the parsed columns, and write each run to an append-only table keyed by (run_id, marketplace, asin). When someone questions a number, you replay the exact response instead of re-scraping and hoping the price has not moved.

Step-by-Step Workflow

Step 1 — Define the marketplace matrix

Start with the marketplaces where you sell or plan to sell. Four to eight is plenty for a first pass; each addition multiplies request volume and matching work. Write the matrix as configuration so adding a country is a one-line change.

Step 2 — Collect one record per (marketplace, product)

Issue one request per pair. Batching many ASINs into one call is tempting, but a single bad ASIN then fails the batch. Space requests with a small interval and retry only on rate-limit and server errors, with exponential backoff.

Step 3 — Normalize currency and tax display

Convert to a reporting currency using a rate table your finance team owns, and stamp the rate date. Record the tax basis per marketplace and compute net-price comparisons where needed. Do not hardcode a VAT percentage for a whole region — rates differ by country and category, and a wrong assumption distorts every conclusion.

Step 4 — Match products across marketplaces

Run matching in tiers and keep the confidence on the record:

  1. Exact ASIN match — highest confidence.
  2. Brand plus GTIN/EAN or model number — strong, and the usual path when ASINs differ.
  3. Normalized title similarity above a strict threshold, with brand equality required.

Anything that falls through stays unmatched and is reported as such. An unmatched product is a gap to review; a wrong match is a false conclusion nobody will catch.

Step 5 — Compute the parity index and flag outliers

For each matched group, pick a base marketplace, convert every price into the reporting currency, and divide each price by the base price. That ratio is the parity index: 1.00 means the same price, 1.20 means 20 percent higher. Report the spread as max minus min across the group, and flag groups above your threshold. Start at 15 percent, then tune it — luxury and bulky goods legitimately vary more than accessories.

Runnable Python Example

The script separates collection from analysis. The collection step reads its request body from an environment variable, because the payload your worker expects should come from your own console, not from a blog post. The analysis step runs offline against saved JSON, so you can test it without network calls.

import csv
import json
import os
import time
from datetime import datetime, timezone

import requests

ENDPOINT = os.environ["CORECLAW_SCRAPER_ENDPOINT"]          # copy from your worker page
API_KEY = os.environ["CORECLAW_API_KEY"]
BODY_TEMPLATE = json.loads(os.environ["CORECLAW_REQUEST_TEMPLATE"])
MARKETPLACES = json.loads(os.environ["MARKETPLACE_MAP"])     # {"US": "amazon.com", "DE": "amazon.de"}
ASINS = json.loads(os.environ["ASIN_LIST"])                  # ["B0XXXXXXXX", ...]
REQUEST_INTERVAL = float(os.environ.get("REQUEST_INTERVAL", "1.0"))
THRESHOLD = float(os.environ.get("PARITY_THRESHOLD", "0.15"))
BASE_MARKET = os.environ.get("BASE_MARKET", "US")
REPORTING = os.environ.get("REPORTING_CURRENCY", "USD")


def build_body(marketplace: str, asin: str) -> dict:
    """Fill the request template you exported from the console."""
    raw = json.dumps(BODY_TEMPLATE)
    raw = raw.replace("{marketplace}", marketplace).replace("{asin}", asin)
    return json.loads(raw)


def fetch(marketplace: str, asin: str, retries: int = 3) -> dict:
    for attempt in range(retries):
        try:
            resp = requests.post(
                ENDPOINT,
                headers={"Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json"},
                json=build_body(marketplace, asin),
                timeout=60,
            )
        except requests.RequestException:
            time.sleep(2 ** attempt)
            continue

        # Retry only on transient conditions; surface everything else immediately.
        if resp.status_code in (429, 500, 502, 503, 504):
            time.sleep(2 ** attempt)
            continue
        resp.raise_for_status()
        return resp.json()

    raise RuntimeError(f"failed after {retries} attempts: {marketplace}/{asin}")


FIELD_MAP = {
    "asin": ("asin",),
    "title": ("title", "product_title"),
    "brand": ("brand",),
    "price": ("price", "price_value", "buybox_price"),
    "currency": ("currency", "currency_code"),
    "seller": ("seller", "sold_by"),
    "availability": ("availability", "stock_status"),
}


def pick(record: dict, keys: tuple):
    for key in keys:
        if record.get(key) not in (None, ""):
            return record[key]
    return None


def to_float(value):
    if value is None:
        return None
    if isinstance(value, (int, float)):
        return float(value)
    cleaned = "".join(ch for ch in str(value) if ch.isdigit() or ch in ".,")
    cleaned = cleaned.replace(".", "").replace(",", ".") if cleaned.count(",") == 1 and cleaned.rfind(",") > cleaned.rfind(".") else cleaned.replace(",", "")
    try:
        return float(cleaned)
    except ValueError:
        return None


def load_fx(path: str) -> dict:
    """Rates file your finance team maintains: {"USD": 1.0, "EUR": 1.08, "GBP": 1.27}."""
    if not os.path.exists(path):
        return {}
    with open(path, encoding="utf-8") as handle:
        return json.load(handle)


def normalize(records: list, fx: dict, reporting: str = "USD") -> list:
    rows = []
    for item in records:
        price = to_float(pick(item, FIELD_MAP["price"]))
        currency = (pick(item, FIELD_MAP["currency"]) or "").upper()
        rate = fx.get(currency)
        if rate is None and currency == reporting:
            rate = 1.0                      # same currency needs no conversion
        rows.append(
            {
                "marketplace": item["marketplace"],
                "asin": pick(item, FIELD_MAP["asin"]),
                "title": pick(item, FIELD_MAP["title"]),
                "brand": pick(item, FIELD_MAP["brand"]),
                "price_local": price,
                "currency": currency,
                "price_reporting": round(price * rate, 2) if price is not None and rate else None,
                "fx_rate": rate,
                "seller": pick(item, FIELD_MAP["seller"]),
                "availability": pick(item, FIELD_MAP["availability"]),
                "captured_at": item.get("captured_at") or datetime.now(timezone.utc).isoformat(),
            }
        )
    return rows


def build_parity(rows: list, base_market: str, threshold: float) -> list:
    groups = {}
    for row in rows:
        if row["price_reporting"] is None:
            continue
        if str(row.get("availability") or "").lower() in {"unavailable", "out of stock"}:
            continue
        groups.setdefault(row["asin"], []).append(row)

    report = []
    for asin, group in groups.items():
        base = next((r for r in group if r["marketplace"] == base_market), None)
        if not base or not base["price_reporting"]:
            continue
        for row in group:
            index = row["price_reporting"] / base["price_reporting"]
            report.append({**row, "base_price": base["price_reporting"], "parity_index": round(index, 3)})

    for asin in groups:
        bucket = [r for r in report if r["asin"] == asin]
        if len(bucket) < 2:
            continue
        spread = max(r["parity_index"] for r in bucket) - min(r["parity_index"] for r in bucket)
        for row in bucket:
            row["spread"] = round(spread, 3)
            row["flagged"] = str(spread >= threshold)
    return report


def main() -> None:
    fx = load_fx(os.environ.get("FX_RATES_FILE", "fx_rates.json"))
    raw, errors = [], []

    for marketplace in MARKETPLACES:
        for asin in ASINS:
            try:
                payload = fetch(marketplace, asin)
                record = payload.get("data", payload) if isinstance(payload, dict) else payload
                record["marketplace"] = marketplace
                raw.append(record)
            except Exception as exc:                     # keep going; report at the end
                errors.append({"marketplace": marketplace, "asin": asin, "error": str(exc)})
            time.sleep(REQUEST_INTERVAL)

    rows = normalize(raw, fx, REPORTING)
    report = build_parity(rows, BASE_MARKET, THRESHOLD)

    stamp = datetime.now(timezone.utc).strftime("%Y%m%dT%H%M%SZ")
    with open(f"raw_{stamp}.json", "w", encoding="utf-8") as handle:
        json.dump(raw, handle, ensure_ascii=False, indent=2)
    if report:
        with open(f"parity_{stamp}.csv", "w", newline="", encoding="utf-8") as handle:
            writer = csv.DictWriter(handle, fieldnames=list(report[0].keys()))
            writer.writeheader()
            writer.writerows(report)

    print(f"records={len(rows)} groups={len({r['asin'] for r in report})} errors={len(errors)}")
    for err in errors:
        print("ERROR", err)


if __name__ == "__main__":
    main()
Enter fullscreen mode Exit fullscreen mode

Two details matter: to_float handles both 1,299.00 and 1.299,00 formats, and unavailable listings are dropped before the parity math instead of being coerced to zero.

Example Output

A report row set for one product across four marketplaces, showing the columns you would read first (illustrative values):

marketplace,asin,price_local,currency,price_reporting,base_price,parity_index,spread,flagged
US,B0EXAMPLE1,129.99,USD,129.99,129.99,1.000,0.181,True
DE,B0EXAMPLE1,139.00,EUR,150.12,129.99,1.155,0.181,True
GB,B0EXAMPLE1,119.00,GBP,151.13,129.99,1.163,0.181,True
JP,B0EXAMPLE1,19800,JPY,127.71,129.99,0.982,0.181,True
Enter fullscreen mode Exit fullscreen mode

All four rows share an ASIN, so the index is comparable, and the 18-point spread clears the 15 percent threshold — which is the trigger for the checks in the next section, not a conclusion. A record that fails matching stays out of the table and is listed as unmatched: if the Japanese listing used a different ASIN and could not be tied to the same model, including it would measure two different products. Store the match method (asin, gtin, title) on every row and review title matches before they reach a dashboard.

Reading the Results: What Actually Drives a Price Gap

A gap above threshold is a question, not a verdict. Check these in order:

  • Tax basis. Compare net to net. A gross-to-gross comparison across a VAT market and a sales-tax market overstates the difference.
  • Seller mix. A third-party offer without the brand's own presence often prices away from the local retail benchmark. That is a channel issue, not a pricing strategy.
  • Fulfillment and shipping. A lower price may simply mean delivery is charged separately or the item ships from another country.
  • Assortment variant. Bundle size, warranty, or model suffix explains many gaps. Confirm the variant before treating the SKU as identical.
  • Currency timing. A gap that appears right after a rate move is usually a repricing lag. Two runs separate the two.

Only a gap that survives all five represents a pricing position worth acting on.

Business Use Cases

Global pricing strategy. A brand entering a new marketplace needs a reference price that reflects local willingness to pay, not a converted home price. The parity index gives a defensible starting point and a way to measure drift after launch.

Price parity and MAP-style programs. Brands that set resale price expectations across regions need evidence when a reseller undercuts in one country. A timestamped, source-linked record beats a screenshot in a partner conversation.

Parallel-import and arbitrage detection. A persistent, large gap between adjacent marketplaces is the signature of cross-border resale — and a signal about where to tighten distribution.

Promotion impact. Before and after a local promotion, the index shows whether a discount moved the product's relative position or merely matched a competitor.

Assortment gaps. Products that will not match across marketplaces because identifiers diverge are often not the same item — useful input for catalog consolidation.

Build vs Buy vs Manual

Approach Strength Weakness Fits
Manual browser checks No setup cost Not repeatable, no timestamps, breaks past ten products One-off sanity checks
Self-hosted scraper Full control of parsing You own proxy rotation, layout changes, and per-marketplace maintenance Teams with dedicated scraping engineering
Managed scraper API Parsing and access handled by the provider Per-record cost; endpoint and field behavior must be verified Teams that need the dataset, not the plumbing
Ready-made worker Fastest path to a schema Less flexible than custom code First version of a parity report

For most teams the answer is a managed source plus your own normalization layer: the matching logic is the part that stays with you when the provider changes.

Limits, Freshness, and Compliance

  • Prices are snapshots. Every number is true for the minute it was captured. Report captured_at beside it and never present one run as a price level.
  • Coverage varies. Availability, currency, and field completeness differ by country. Check current coverage before committing to a twelve-marketplace plan.
  • Catalog drift. ASINs, bundles, and listings change. Re-verify matches monthly; a stale match is worse than no match.
  • Public data only. Collect publicly displayed product pages. Do not touch account data, order data, or anything behind a login.
  • Platform terms and law. Review each marketplace's terms and applicable law for your jurisdiction. Where automated access is restricted, use an authorized source rather than working around it; if a page presents a challenge, stop and reduce volume instead of building challenge-solving logic.
  • Antitrust discipline. Competitor prices inform your own decisions. Using shared price data to align prices with competitors — or exchanging pricing intentions with them — can be illegal in many jurisdictions. Keep the analysis internal and one-directional.
  • Not legal advice. Compliance questions about resale price programs belong with counsel.

FAQ

Do I need a different ASIN for each marketplace?
Often, but not always. Some marketplaces share ASINs for identical catalog entries and others assign their own. Treat ASIN as the primary key with a fallback chain, not as a global identifier.

Should I compare prices with or without tax?
Compare like with like. Net-to-net suits margin analysis; gross-to-gross reflects what a shopper sees. Pick one, label it, and never mix the two in a chart.

How often should the parity report run?
Weekly suits most catalogs. Run daily only during a launch, a promotion window, or a currency event — one run cannot distinguish a repricing lag from a pricing decision.

What if a product is unavailable in one marketplace?
Exclude it from the parity math and report it as a coverage gap. Substituting zero or the base price creates a fake comparison that will be quoted in a meeting six weeks later.

Can I use this data to set prices automatically?
You can, but automatic repricing against competitor data can trigger price spirals and, depending on use, raise antitrust exposure. Keep a human approval step and document the rule behind each change.

How do I handle a currency with no rate in my table?
Leave the converted value empty and list the record under "missing FX". An imputed rate is indistinguishable from a real one once it is in the CSV.

How do I keep matching accurate as the catalog grows?
Persist match method and confidence per row, review every title-based match manually, and re-run the GTIN check when identifiers change. Matching quality degrades quietly, so audit it on a schedule.

Next Steps

Start with one product family and four marketplaces. Collect a run, normalize it, and read the unmatched records first — they say more about your catalog than the matched ones. Once the match rate is stable, schedule a weekly run into an append-only table so you can chart the parity index over time instead of staring at one snapshot.

If you want the collection layer handled, the CoreClaw Amazon Global Product Scraper covers cross-marketplace product records; check the current field set and marketplace coverage there before wiring it into the script. For a custom schema, build a worker in the CoreClaw Workers console. Ready-made workers for search, maps, social, and e-commerce data are in the CoreClaw Store.

Top comments (0)