DEV Community

voiddo
voiddo

Posted on Originally published at voidd0.github.io

Alibaba Scraper: how to get Prices, MOQ, Suppliers as JSON or CSV (Python, API, no code)

Scrape Alibaba.com product offers by keyword: title, price range and quantity price tiers, minimum order, units sold, ratings, certifications, and the supplier's name, country, years, Gold and verified badges, Trade Assurance and response rate.

This tutorial shows what the Actor v0iddo/alibaba-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
productId Product ID text 1601209913000
title Title text Wholesale Custom Print logo Curve Arch Oval Shape Eco-friendly Yoga...
priceMin Price from number 13.9
priceMax Price to number 13.9
minOrder Min order number 1
minOrderUnit Unit text piece
sold Sold number 655
supplierName Supplier text Hunan Sanmo Sports Goods Co., Ltd.
supplierCountry Country text China
url Product URL URL https://www.alibaba.com/product-detail/wholesale-eco-friendly-custo...
searchTerm searchTerm text yoga mat
page page number 1
position position number 1
currency currency text USD
priceText priceText text US $13.90
minOrderText minOrderText text 1 piece
quantityPrices quantityPrices list [{"minQuantity": 1, "maxQuantity": null, "price": 13.9, "unit": "Pi...
soldText soldText text 655 sold
productRating productRating number 4.9
supplierRating supplierRating number 4.8
supplierReviews supplierReviews number 122
certifications certifications list ["REACH"]
supplierCountryCode supplierCountryCode text CN
supplierYears supplierYears number 3
goldSupplier goldSupplier true/false true
verifiedSupplier verifiedSupplier true/false true
tradeAssurance tradeAssurance true/false true
responseRate responseRate number 99.9
image image text https://s.alicdn.com/@sc04/kf/H5f8e09fbf6ac46dc8186def59e788754q.jpg

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

[
  {
    "searchTerm": "yoga mat",
    "page": 1,
    "position": 1,
    "productId": "1601209913000",
    "title": "Wholesale Custom Print logo Curve Arch Oval Shape Eco-friendly Yoga Mats Pu Rubber Non-slip Pilates Mat Tapis Yoga Workout Mats",
    "priceMin": 13.9,
    "priceMax": 13.9,
    "currency": "USD",
    "priceText": "US $13.90",
    "minOrder": 1,
    "minOrderUnit": "piece",
    "minOrderText": "1 piece",
    "quantityPrices": [
      {
        "minQuantity": 1,
        "maxQuantity": null,
        "price": 13.9,
        "unit": "Piece"
      }
    ],
    "sold": 655,
    "soldText": "655 sold",
    "productRating": 4.9,
    "supplierRating": 4.8,
    "supplierReviews": 122,
    "certifications": [
      "REACH"
    ],
    "supplierName": "Hunan Sanmo Sports Goods Co., Ltd.",
    "supplierCountry": "China",
    "supplierCountryCode": "CN",
    "supplierYears": 3,
    "goldSupplier": true,
    "verifiedSupplier": true,
    "tradeAssurance": true,
    "responseRate": 99.9,
    "image": "https://s.alicdn.com/@sc04/kf/H5f8e09fbf6ac46dc8186def59e788754q.jpg",
    "url": "https://www.alibaba.com/product-detail/wholesale-eco-friendly-custom-print-logo_1601209913000.html"
  },
  {
    "searchTerm": "yoga mat",
    "page": 1,
    "position": 2,
    "productId": "1601619033222",
    "title": "Factory Wholesale Custom Logo Coconut Eco Friendly PU Rubber Yoga Mat Foldable PU Travel Yoga Mat Body Line Oval Pill Shape Mat",
    "priceMin": 8.5,
    "priceMax": 11.5,
    "currency": "USD",
    "priceText": "US $8.50-$11.50",
    "minOrder": 5,
    "minOrderUnit": "pieces",
    "minOrderText": "5 pieces",
    "quantityPrices": [
      {
        "minQuantity": 5,
        "maxQuantity": 49,
        "price": 11.5,
        "unit": "pieces"
      },
      {
        "minQuantity": 50,
        "maxQuantity": 199,
        "price": 10.9,
        "unit": "pieces"
      },
      {
        "minQuantity": 200,
        "maxQuantity": 999,
        "price": 10.1,
        "unit": "pieces"
      }
    ],
    "sold": 699,
    "soldText": "699 sold",
    "productRating": 4.7,
    "supplierRating": 4.7,
    "supplierReviews": 21,
    "supplierName": "Yiwu Chi'an Trading Co., Ltd.",
    "supplierCountry": "China",
    "supplierCountryCode": "CN",
    "supplierYears": 2,
    "goldSupplier": true,
    "verifiedSupplier": true,
    "tradeAssurance": true,
    "responseRate": 100,
    "image": "https://s.alicdn.com/@sc04/kf/Hca11ad78fa574389a2a122cae41e6966E.png",
    "url": "https://www.alibaba.com/product-detail/Factory-Wholesale-Custom-Logo-Coconut-Eco_1601619033222.html"
  }
]
Enter fullscreen mode Exit fullscreen mode

No code: run it on the Apify Store

  1. Open the Alibaba 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:

{
  "searchTerms": [
    "led strip lights"
  ],
  "maxPages": 1,
  "maxItems": 20
}
Enter fullscreen mode Exit fullscreen mode

Ready-made examples

Saved inputs on Apify: run one as it is, or copy it and change the values.

Python (apify-client)

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

from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_TOKEN")

run_input = {'searchTerms': ['led strip lights'], 'maxPages': 1, 'maxItems': 20}

run = client.actor("v0iddo/alibaba-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~alibaba-scraper/run-sync-get-dataset-items" \
  -H "Authorization: Bearer YOUR_APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"searchTerms": ["led strip lights"], "maxPages": 1, "maxItems": 20}'
Enter fullscreen mode Exit fullscreen mode

Good to know

  • Reads Alibaba's public keyword pages (alibaba.com/wholesale/...). Its search box pages are closed to automated access in robots.txt, so filters such as price range or supplier type are not offered.
  • Most product keywords have a page. When one has none, the run tries the plural once and logs the keyword if that has none either.
  • Prices are as shown to a visitor of the English site, usually in US dollars; quantityPrices lists the price per quantity tier when the offer has tiers.
  • Supplier contact details are not collected.

Price

$0.75 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 $0.53 per 1,000.

FAQ

What data does the Alibaba Scraper return?

Each result is one row in an Apify dataset. Fields include productId, title, priceMin, priceMax, minOrder, minOrderUnit, sold, supplierName, 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?

$0.75 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 $0.53 per 1,000. A new Apify account gets $5 of platform credit every month.

Links

Top comments (0)