DEV Community

Gio Rich
Gio Rich

Posted on Fully Autonomous

Build an Alibaba supplier shortlist with Python (prices, MOQ, verified badges)

I built this actor; it's a paid tool on Apify with a free trial credit.

Sourcing on Alibaba means opening dozens of tabs, squinting at price ranges like "US $8.00-$11.00", and trying to remember which supplier had the lower MOQ and which one was actually verified. The price you care about depends on how many units you're ordering, and that's buried in each listing's quantity tiers.

I'm an 18-year-old engineering student, and I built Alibaba Product Search Scraper to get all of that into one table. This post covers calling it from Python and Node, the output, and a small script that ranks suppliers by unit price at a given order quantity.

How it works

Alibaba's search page loads its product grid as JSON from an internal endpoint. The actor calls that endpoint directly over plain HTTP (no headless browser), 48 products per request, using the same filter parameters the site uses for price, MOQ, supplier country and verified status. A search of 1,000 products takes about 20 seconds.

Python example

pip install apify-client
Enter fullscreen mode Exit fullscreen mode
from apify_client import ApifyClient

client = ApifyClient("<YOUR_APIFY_TOKEN>")

run = client.actor("rel8ble/alibaba-product-search-scraper").call(run_input={
    "searchTerms": ["yoga mat"],
    "maxResultsPerSearch": 100,
    "maxMoq": 100,
    "verifiedSuppliersOnly": True,
})

for p in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(p["priceText"], p["moqText"], p["supplierName"], p["supplierYears"])
Enter fullscreen mode Exit fullscreen mode

Node example

import { ApifyClient } from "apify-client";

const client = new ApifyClient({ token: "<YOUR_APIFY_TOKEN>" });

const run = await client.actor("rel8ble/alibaba-product-search-scraper").call({
  searchTerms: ["led strip lights"],
  maxResultsPerSearch: 200,
  supplierCountry: "CN",
  includeAds: false,
});

const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items.length, "products");
Enter fullscreen mode Exit fullscreen mode

What comes back

One item per product, 55 fields. A real row for "yoga mat", trimmed:

{
  "searchTerm": "yoga mat",
  "productId": "1601583212388",
  "title": "High Quality Eco-Friendly Premium Extra Large Yoga Gym Mat Custom Logo ...",
  "url": "https://www.alibaba.com/product-detail/High-Quality-Eco-Friendly-Premium-Extra_1601583212388.html",
  "priceMin": 8,
  "priceMax": 11,
  "priceText": "US $8.00-$11.00",
  "priceTiers": [
    { "minQuantity": 50, "maxQuantity": 999, "price": 11, "unit": "pieces" },
    { "minQuantity": 1000, "maxQuantity": 4999, "price": 10, "unit": "pieces" },
    { "minQuantity": 5000, "maxQuantity": 9999, "price": 9, "unit": "pieces" },
    { "minQuantity": 10000, "maxQuantity": null, "price": 8, "unit": "pieces" }
  ],
  "moq": 50,
  "moqUnit": "pieces",
  "soldCount": 378,
  "leadTimeDays": 35,
  "isAd": false,
  "supplierName": "DONGGUAN TONGTIANXIA RUBBER CO., LTD.",
  "supplierCountryCode": "CN",
  "supplierYears": 19,
  "verifiedSupplier": true,
  "goldSupplier": true,
  "tradeAssurance": true,
  "supplierRating": 4.8,
  "supplierReviewCount": 25,
  "responseRate": "99.9%",
  "supplierEmployees": 130,
  "supplierCertifications": ["ISO", "FSC"],
  "supplierVerifiedBy": "SGS"
}
Enter fullscreen mode Exit fullscreen mode

priceTiers is the part that makes this useful. It's the full quantity ladder, so you can work out what you'd actually pay per unit at your order size.

Use case: rank suppliers by real unit price at your order quantity

You want 1,000 yoga mats from a verified supplier with at least a few years on Alibaba. Here's a script that reads each product's tiers, finds the price at 1,000 units, and writes a sorted shortlist.

import csv
from apify_client import ApifyClient

ORDER_QTY = 1000

def price_at(product, qty):
    tiers = product.get("priceTiers") or []
    for t in tiers:
        top = t["maxQuantity"] if t["maxQuantity"] is not None else float("inf")
        if t["minQuantity"] <= qty <= top:
            return t["price"]
    # one flat price and no tiers: fall back to the listed max
    return product.get("priceMax")

client = ApifyClient("<YOUR_APIFY_TOKEN>")
run = client.actor("rel8ble/alibaba-product-search-scraper").call(run_input={
    "searchTerms": ["yoga mat tpe", "yoga mat cork"],
    "maxResultsPerSearch": 300,
    "maxMoq": ORDER_QTY,
    "verifiedSuppliersOnly": True,
    "includeAds": False,
})

rows = []
for p in client.dataset(run["defaultDatasetId"]).iterate_items():
    unit = price_at(p, ORDER_QTY)
    if unit is None or (p.get("supplierYears") or 0) < 3:
        continue
    rows.append([unit, unit * ORDER_QTY, p["supplierName"], p["supplierYears"],
                 p.get("supplierRating"), p.get("responseRate"), p["moq"], p["url"]])

rows.sort(key=lambda r: r[0])
with open("yoga-mat-shortlist.csv", "w", newline="", encoding="utf-8") as f:
    w = csv.writer(f)
    w.writerow(["unitPrice", "orderTotal", "supplier", "years", "rating", "responseRate", "moq", "url"])
    w.writerows(rows)
print(f"{len(rows)} candidates written")
Enter fullscreen mode Exit fullscreen mode

This is a starting list, not a decision. Search prices are list prices from the card; shipping, options and your final quote will move them. But it gets you from hundreds of tabs to 20 suppliers worth messaging.

Tip: Alibaba serves at most about 960 products per keyword, so split broad terms into specific ones ("yoga mat tpe", "yoga mat cork") the way the script does.

What it costs

$1.50 per 1,000 results, one result = one product saved. Duplicates and failed requests aren't charged.

  • The shortlist job above (2 keywords × 300) = 600 products ≈ $0.90
  • 10,000 products = $15
  • Apify's free plan gives $5 of monthly credit, about 3,300 products

Limits

  • About 960 unique products per keyword. Alibaba serves 20 pages of 48, whatever match count it reports.
  • Alibaba matches loosely. Narrow or misspelled keywords still return related products. Check titles if precision matters.
  • USD list prices from the search card. Final price depends on quantity, options and shipping.
  • Country-level supplier location only. Province and city are on the profile page, which the actor doesn't open.
  • Search results only. No full product specs, SKU/variant lists or review texts in this version.
  • minPrice / maxPrice take whole dollars.

Issues tab on the actor page if anything's off.

Alibaba Product Search Scraper on Apify


This article was drafted with AI and published by me.

Top comments (0)