跳到正文
DEV Community· Serenido·· 5 小時前AI 評分50

如何用 Python 按精確訂單數找出 AliExpress 熱賣商品

Find best-selling AliExpress products by exact order count with Python

AI 導讀

作者示範以 Python 呼叫其 Apify 工具搜尋 AliExpress 商品,擷取精確訂單數、價格和評分,再按訂單數挑選熱賣商品。一次實測搜尋 120 件商品耗時 7 秒,榜首精確訂單數為 12,544,但 AliExpress 搜尋卡只顯示「10,000+ sold」。這次搜尋有 85 件商品標記為新客優惠,篩除後保留 35 件一般價格商品。

正文

AliExpress search pages round sales into buckets like "10,000+ sold". That hides the difference between a product with 10,100 orders and one with 19,900. For product research you want the real number.

This post shows how to search AliExpress from Python and get the exact order count, price, rating and a few useful flags for every product, then pick the best sellers.

Disclosure: I built the tool used below. It runs on Apify and costs $0.25 per 1,000 products.

What you get for each product

  • Price, crossed-out price, discount and currency
  • Exact order count, plus the rounded text AliExpress shows
  • Star rating, ships-from country and delivery estimate
  • Flags: AliExpress Choice, free shipping, sponsored (ad) and new-shopper deal
  • Product link, image, category id and its rank in the search results

24 ship-to countries, each with its local currency. Sort by best match, orders, or price (low or high).

Step 1: Install the client

pip install apify-client

You need a free Apify account for the API token. The free plan gives $5 of usage every month, no credit card needed. Find the token in Apify Console under Settings > API & Integrations.

Step 2: Search and pick the best sellers

from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_TOKEN")

run = client.actor("serenido/aliexpress-search-reliable").call(run_input={
    "searchTerms": ["yoga mat"],
    "maxItems": 120,
    "sortBy": "orders",
    "country": "US",
    "minRating": 4.5,
})

products = list(client.dataset(run["defaultDatasetId"]).iterate_items())
normal = [p for p in products if not p["isNewShopperDeal"]]
print(len(products), "products,", len(normal), "with normal prices")

for p in sorted(normal, key=lambda p: p["orders"] or 0, reverse=True)[:5]:
    print(f'{p["orders"]:>6} orders  ${p["price"]:<6} {p["rating"]}  {p["title"][:50]}')

The result

From a real run on October 14. The 120 products took 7 seconds:

120 products, 35 with normal prices
 12544 orders  $6.19   4.9  Yoga Mat Pilates Fitness Mat 3/4/6mm Thicknes Non
  9056 orders  $1.33   4.9  Yoga Kneeling Mat Thickened Flat Support Mat Knee
  4380 orders  $14.59  4.9  Foldable Yoga Mat Mute  Eco Friendly Folding Trave
  2776 orders  $12.95  4.9  Balance Pad Non-Slip Foam Mat Ankles Knee Cushion
  2739 orders  $9.59   4.9  8/16 Pcs Foam Fitness Non Slip Yoga Mat Fitness Fl

The top product's search card said "10,000+ sold". The exact count is 12,544.

Two things to know

1. Most prices you see logged out are first-order prices. AliExpress shows very low "welcome" prices to visitors who are not logged in, valid for a first order only. In this run, 85 of 120 products were flagged isNewShopperDeal. The code keeps only the other 35, so the prices are ones most buyers would pay.

2. You get what AliExpress search returns. That includes the odd unrelated item: in this run, one of the 120 "yoga mat" results was a glow-in-the-dark rug. Filter by title if you need a clean list.

Useful filters

All of these go in run_input:

  • minPrice, maxPrice, minOrders, minRating
  • freeShippingOnly, choiceOnly, skipSponsored
  • shipFromCountry (for example, only products that ship from a US warehouse)
  • startUrls: paste AliExpress search or category links instead of keywords

Next step: the full product

Search results show one price per product. For every variant (color, size) with its own price and stock, plus shipping to your country, see my earlier post: How to get AliExpress product variants, stock and shipping as JSON with Python.

Cost

$0.25 per 1,000 products, plus a small start fee of $0.00005 per GB of memory, which is $0.0002 per run at the default 4 GB. AliExpress blocks datacenter IPs, so the tool uses residential IPs and retries blocked pages on its own.

Use it from an AI assistant

The tool also works through Apify's MCP server, so Claude, ChatGPT, Cursor or VS Code can run it for you. Add this server URL to your app: https://mcp.apify.com?tools=serenido/aliexpress-search-reliable

Links

If you need another filter, tell me in the comments.

來源:DEV Community · dev.to