
摘要:从事跨境电商系统开发十年,踩过大量海外爬虫风控、页面改版失效、多站点数据口径不一致的坑。本文从工程落地视角,复盘速卖通开放平台商品详情接口aliexpress.solution.product.detail.get的接入全过程,拆解关键字段含义,讲解多站点市场数据批量采集、清洗、入库整套方案,同时分享项目上线后遇到的权限、限流、币种、销量口径等实战踩坑经验。适合跨境选品系统、竞品监控平台、数据分析项目开发人员阅读。
早年做跨境竞品数据采集,团队长期使用爬虫抓取速卖通前台页面,遇到几个持续性痛点:
在多个项目迭代后,我们把数据采集方案迁移到速卖通开放平台aliexpress.solution.product.detail.get商品详情接口。接口返回标准化 JSON,字段稳定,官方合规通道,适合长期持续采集市场数据,用于类目调研、竞品监控、爆款挖掘。
前置提醒:该接口属于 ISV / 商家开放接口,需要在速卖通开放平台创建应用,提交资质,申请对应权限包;部分高敏感字段(真实底层库存)存在权限门槛,个人应用无法获取。
{
"aliexpress_solution_product_detail_get_response": {
"product": {
"product_id": "1005004567891234",
"subject": "Portable Outdoor Camping Folding Chair",
"main_image": "https://ae01.alicdn.com/kf/HTBxxxx.jpg",
"images": [
"https://ae01.alicdn.com/kf/HTBxxxx1.jpg",
"https://ae01.alicdn.com/kf/HTBxxxx2.jpg"
],
"category_id": 200000123,
"category_name": "Sports & Entertainment > Camping Furniture",
"price_info": {
"original_price": "32.50",
"sale_price": "18.90",
"currency": "USD",
"discount_rate": "42%"
},
"sales_info": {
"sales": 12560,
"recent_sales": 3280
},
"review_info": {
"review_count": 1689,
"avg_star": 4.7
},
"stock_info": {
"total_stock": 5200
},
"sku_list": [
{
"sku_id": "12345678901",
"sku_attr": "Color:Black;Size:30cm",
"sku_price": "18.90",
"sku_stock": 320
}
],
"shipping_info": {
"shipping_cost": "2.30",
"delivery_days": "15-30"
},
"product_attributes": [
{"attr_name":"Material","attr_value":"Aluminum Alloy"},
{"attr_name":"Weight","attr_value":"1.2kg"}
],
"shop_info": {
"shop_id": 1000123456,
"shop_name": "Outdoor Official Store",
"shop_score": 4.8
}
}
}
}工程注意:不同 country_code 返回 sale_price 完全不同,做多国市场对比必须绑定站点编码,不能混用。
商品 ID 池 → 任务调度器 → 令牌桶限流控制 → 调用速卖通 API → 原始数据落库 → 数据清洗加工 → 存入分析库 → BI 看板展示
from top import AeClient
import pandas as pd
client = AeClient("https://gw.api.aliexpress.com/rest", appkey, appsecret)
def fetch_ae_product(product_id, country_code="US", language="en"):
req = AliexpressSolutionProductDetailGetRequest()
req.set_product_id(product_id)
req.set_country_code(country_code)
req.set_language(language)
resp = client.execute(req)
product = resp.aliexpress_solution_product_detail_get_response.product
result = {
"product_id": product.product_id,
"title": product.subject,
"sale_price": product.price_info.sale_price,
"currency": product.price_info.currency,
"sales": product.sales_info.sales,
"recent_sales": product.sales_info.recent_sales,
"review_count": product.review_info.review_count,
"avg_star": product.review_info.avg_star,
"shipping_cost": product.shipping_info.shipping_cost,
"shop_name": product.shop_info.shop_name
}
return result
product_id_list = ["1005004567891234"]
data_set = []
for pid in product_id_list:
data_set.append(fetch_ae_product(pid,"US","en"))
df = pd.DataFrame(data_set)
df.to_csv("ae_market_data.csv",index=False,encoding="utf-8-sig")原始接口返回数据不能直接用于分析,必须做标准化处理:
业务可落地指标:
八年跨境项目经验来看,速卖通商品详情 API 是做跨境市场数据采集更稳定合规的方案。虽然前期有应用资质、权限、调用额度的门槛,但相比爬虫,省去大量反爬对抗和页面解析维护工作。 项目落地的关键点:区分多站点参数、做好限流与 token 管理、理解销量数据延迟特性、建立完善的数据清洗规则,就能搭建长期稳定的跨境商品数据采集系统。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。