Skip to content

Repository files navigation

alibaba-scraper

CI Python License: MIT

Scrape Alibaba.com product search results into clean, typed JSON or CSV: price ranges, MOQ, suppliers and ratings, with no CSS selectors to maintain.

Search Alibaba.com for any product with Alibaba's own filters and get back one clean record per product: product id, title, price range and currency, discounted price, minimum order quantity (MOQ) and unit, units sold, the supplier's name, country, years on Alibaba, store rating breakdown and reorder rate, certifications (CE, FCC, RoHS…), selling points, the sponsored flag, full-size images and product / supplier URLs.

Powered by ScrapeUnblocker. Every Alibaba page is loaded in a real browser through the getPageSource API, and products are read from the structured data Alibaba embeds in each search page, not from the rendered cards.

Features

  • 🏭 Built for sourcing: price range (price_min / price_max), MOQ as a number plus unit (1000 + "pieces"), units sold, supplier country and years on Alibaba, reorder rate and certifications, all typed and ready to sort.
  • πŸŽ›οΈ Alibaba's own filters: supplier country, unit price range, maximum MOQ, Trade Assurance, Verified Supplier, product certification (e.g. CE), store rating 4+ / 4.5+ / 5, and sort by sales. Alibaba echoes the filters it applied, and the CLI prints them so you can check them.
  • πŸ’² Real price ranges: "$2.80-4.80" becomes price_min: 2.8, price_max: 4.8, currency: "USD"; discounted cards also get promo_price_min / promo_price_max and the discount label.
  • πŸ”Ž Several keywords at once: pass multiple search terms (or search URLs); results are merged and de-duplicated by product id.
  • πŸ“„ Multi-page collection: 48 products per page, follows Alibaba's page count and stops at the last page, with --pages / --limit caps.
  • 🚫 Sponsored control: every product carries sponsored: true/false, and --no-sponsored drops ads.
  • πŸ–ΌοΈ Full-size images: thumbnails (..._300x300.jpg) are upgraded to the original image URLs; the thumbnail is kept too.
  • πŸ” Resilient: Alibaba's slide-to-verify challenge page is recognised and retried with doubling backoff, and "no products match" comes back as an empty result, not an error.
  • πŸ–₯️ CLI + library: use alibaba-scraper from the shell or import it in Python.

Install

pip install .
# or, for development:
pip install -e ".[dev]"

Set your ScrapeUnblocker API key (grab one from your dashboard):

cp .env.example .env          # then edit it, or just export the variable:
export SCRAPEUNBLOCKER_KEY=your_key_here

CLI usage

# One keyword, pretty-printed JSON to stdout
alibaba-scraper "bluetooth earbuds" --pretty

# Best sellers from Trade Assurance suppliers in China, MOQ of 100 or less, 2 pages
alibaba-scraper "stainless steel water bottle" --supplier-country CN --trade-assurance \
  --max-moq 100 --sort sales --pages 2 --output bottles.json

# Verified suppliers only, CE-certified, store rating 4.5+, unit price $1-5
alibaba-scraper "phone case" --verified-supplier --certification CE --min-rating 4.5 \
  --min-price 1 --max-price 5

# Several keywords merged into one CSV, without sponsored products
alibaba-scraper "yoga mat" "resistance bands" "foam roller" --no-sponsored \
  --format csv --output fitness.csv

# Any search you set up on alibaba.com: just paste the URL
alibaba-scraper --url "https://www.alibaba.com/trade/search?SearchText=led+strip+lights&ta=y"

Progress goes to stderr and echoes the filters Alibaba applied:

[alibaba] "stainless steel water bottle" page 1/100: 48 products (60,000+ results) - Supplier features: Trade Assurance; Supplier Location: China; Min Order: 100
[alibaba] "stainless steel water bottle" page 2/100: 48 products (80,000+ results) - Supplier features: Trade Assurance; Supplier Location: China; Min Order: 100
Wrote 96 products to bottles.json
usage: alibaba-scraper [-h] [--url URL] [--supplier-country ISO]
                       [--min-price PRICE] [--max-price PRICE] [--max-moq QTY]
                       [--trade-assurance] [--verified-supplier]
                       [--certification TAG] [--min-rating STARS]
                       [-s {relevance,sales}] [--no-sponsored] [-p PAGES]
                       [-n LIMIT] [-c ISO] [--retries N] [-f {json,csv}]
                       [-o PATH] [--pretty] [-q] [--version]
                       [KEYWORD ...]
Option Meaning
KEYWORD ... / --url What to search: one or more keywords, or one or more Alibaba search URLs.
--supplier-country Supplier location, 2-letter code: CN, VN, IN, US, …
--min-price / --max-price Unit-price bounds, in the currency Alibaba shows (USD by default).
--max-moq Only products whose minimum order is at most this quantity.
--trade-assurance Only suppliers offering Alibaba Trade Assurance.
--verified-supplier Only Alibaba Verified Suppliers.
--certification Product certification tag, e.g. CE, FCC, ROHS.
--min-rating Store rating floor: 4, 4.5 or 5.
-s, --sort relevance (Alibaba's default) or sales (Alibaba's "sort by sales volume").
--no-sponsored Drop sponsored (ad) products.
-p, --pages / -n, --limit Max pages per search (48 products each) / max products overall.
-c, --country Country to route through (default US). Alibaba prices results in that country's currency.
--retries Retries per page on a transient error or challenge page (default 5, doubling backoff).
-f, --format / -o, --output json (default) or csv (needs --output).

Library usage

from alibaba_scraper import AlibabaScraper, to_csv

scraper = AlibabaScraper()  # reads SCRAPEUNBLOCKER_KEY

bottles = scraper.search(
    "stainless steel water bottle",
    supplier_country="CN",
    trade_assurance=True,
    max_moq=100,
    sort="sales",
    pages=2,
)
for p in bottles[:5]:
    print(
        f"{p.price_min}-{p.price_max} {p.currency}  MOQ {p.moq} {p.moq_unit}  "
        f"{p.sold} sold  {p.supplier_name} ({p.supplier_years} yrs)"
    )

# Same filters over several keywords, merged and de-duplicated
fitness = scraper.search_many(["yoga mat", "resistance bands"], min_rating=4.5)

to_csv(bottles + fitness, "alibaba.csv")

Other entry points:

  • scraper.scrape_url(url, pages=3) scrapes any Alibaba search URL (it starts from the URL's own page).
  • scraper.scrape_many([url1, url2], limit=500) merges several searches, de-duplicated.
  • build_search_url("yoga mat", max_moq=50, sort="sales") just builds the URL.
  • on_page=callback receives each SearchPage with Alibaba's total_count, result_count, page / total_pages and the applied filters.
  • AlibabaScraper(retries=..., backoff=..., on_retry=callback) tunes the retry policy.

Example output

A real product from the search above (images trimmed):

{
  "product_id": "1600661231106",
  "title": "Customized Color logo Reusable Gym Sport Metal Bottles Sublimation Stainless Steel Vacuum Flasks Thermos Drinking Water Bottle",
  "url": "https://www.alibaba.com/product-detail/Customized-Color-logo-Reusable-Gym-Sport_1600661231106.html",
  "price_min": 3.72,
  "price_max": 3.72,
  "currency": "USD",
  "price_display": "$3.72",
  "promo_price_min": 2.05,
  "promo_price_max": 2.05,
  "discount": "45% off",
  "moq": 10,
  "moq_unit": "pieces",
  "sold": 3609,
  "review_score": 4.7,
  "review_count": 90,
  "product_score": 4.8,
  "shipping_score": 4.5,
  "service_score": 4.7,
  "reorder_rate": 22,
  "certifications": ["CE"],
  "selling_points": ["Delivery by Oct 27", "Money-back guarantee", "Reorder rate 22%"],
  "supplier_name": "Jieyang Fangyuan Stainless Steel Products Co., Ltd.",
  "supplier_id": "249462834",
  "supplier_country": "CN",
  "supplier_years": 7,
  "supplier_url": "https://fangyuan-xd.en.alibaba.com/company_profile.html",
  "supplier_store_url": "https://fangyuan-xd.en.alibaba.com/",
  "sponsored": false,
  "image": "https://s.alicdn.com/@sc04/kf/H041b4be1ffe64691a107c0ab90846835y.jpg",
  "thumbnail": "https://s.alicdn.com/@sc04/kf/H041b4be1ffe64691a107c0ab90846835y.jpg_300x300.jpg",
  "images": [
    "https://s.alicdn.com/@sc04/kf/H041b4be1ffe64691a107c0ab90846835y.jpg",
    "https://s.alicdn.com/@sc04/kf/Haf8ad6e9c1e24bdd8fb881891885a003e.jpg"
  ]
}

Field notes:

  • price_min / price_max are the range printed on the card (equal for a single price). Alibaba prices are tiered, so bigger orders pay closer to price_min.
  • review_score / review_count are the supplier's store rating (the value Alibaba's "Store reviews" filter uses); product_score, shipping_score and service_score are Alibaba's sub-scores.
  • reorder_rate is a percentage, taken from Alibaba's "Reorder rate N%" badge when the card shows one. sold is Alibaba's "N sold" counter.
  • supplier_years is how many years the supplier has been a Gold Supplier on Alibaba.
  • Missing values are null, never empty strings. In CSV output, certifications, selling_points and images are joined with " | ".

Good to know

  • Currency follows the route. Alibaba shows prices in the visitor's currency: the default --country US gives USD, and routing through Germany gives EUR. Every product carries its currency, and --min-price / --max-price apply in that currency.
  • Challenge pages. Alibaba sometimes answers with a slide-to-verify page instead of results, often for a few minutes at a time. The scraper recognises it (AlibabaBlockedError) and retries with doubling backoff: 5, 10, 20, 40 and 60 seconds by default. If a run still fails, try again a few minutes later or raise --retries. Each attempt is a normal API request.
  • Search depth. Alibaba serves at most 100 pages (4,800 products) per search. To go wider, split a search by supplier country, price band or keyword and merge the results with search_many, which de-duplicates for you.
  • No results. If nothing matches (for example, very strict filters), Alibaba's "did not match any products" page comes back as an empty list.

Project layout

src/alibaba_scraper/
  __init__.py      package exports + version
  scraper.py       Product model, AlibabaScraper, URL builder, page parsing, JSON/CSV export
  cli.py           argparse command-line interface
examples/          runnable scripts (search β†’ JSON, multi-keyword β†’ CSV, supplier shortlist)
tests/             offline unit tests (SDK mocked, no API credit spent)

Development

make install       # editable install with dev deps
make lint          # ruff check
make format        # ruff format
make test          # pytest (offline; the SDK is mocked)
make run           # run the search β†’ JSON example (needs SCRAPEUNBLOCKER_KEY)

The test suite mocks the ScrapeUnblocker client and uses synthetic Alibaba pages, so make test runs fully offline and spends no API credits.

Links

Legal

For research and educational use. Respect Alibaba.com's Terms of Use and robots.txt, data-protection law and other applicable laws when scraping and storing product and supplier data. This project is not affiliated with or endorsed by Alibaba.com.

License

MIT, see LICENSE. Copyright (c) 2026 ScrapeUnblocker.

About

Scrape Alibaba.com product search results into clean JSON/CSV - price ranges, MOQ, units sold, supplier country, ratings and certifications - with Alibaba's own filters. Python CLI + library powered by the ScrapeUnblocker API.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages