用途
apify-ecommerce 是一个电商数据抓取技能,目标是用自然语言回答电商相关问题:它先把用户消息分类为具体意图,再路由到对应的 Apify Actor,最后通过 apify CLI 获取数据并给出整合后的答案。覆盖 30 多个平台,包括 Amazon、Walmart、eBay、Shopify、WooCommerce 等。
主要能力
技能可识别的意图包括:定价(price、cost、cheapest、compare prices)、评论(review、rating、sentiment、stars)、畅销榜(bestseller、top selling、trending)、卖家(seller、vendor、reseller)、店铺抓取(scrape store、full catalog)、技术栈(what platform、built on、Shopify or WooCommerce)、SEO 审计、竞品分析、搜索意图、商品匹配、外卖(DoorDash、UberEats、TheFork)、店铺信息补全、活动(Eventbrite)、房地产(Realtor)、广告情报(Facebook/Meta ads)、分类信息(Craigslist)、汽车(Webmotors)、内容发现(Pinterest)、TikTok Shop、网站交易市场(Flippa)。
路由采用主 Actor 优先、失败或返回 0 结果时切换备用 Actor 的策略。主 Actor 为 apify/e-commerce-scraping-tool,通过不同输入模式处理大多数意图:有目标 URL 时用 detailsUrls / listingUrls;有关键词或市场时用 keyword + marketplaces;广泛发现类意图用 searchEngineKeyword。对于主 Actor 确实无法处理的意图(tech-stack、seo-audit、store-enrichment、product-matching、ads-intelligence、content-discovery、tiktok-shop),直接使用备用 Actor。若主备均失败,可用 apify actors search 命令实时发现替代 Actor,并过滤用户数 ≥100、评分 ≥4.5 的结果。
使用方式
前置条件:Apify CLI v1.5.0+(npm install -g apify-cli);jq(推荐,macOS 用 brew install jq,Linux 用 apt install jq);认证通过 apify login(OAuth,打开浏览器)或 APIFY_TOKEN 环境变量,Token 来自 Apify Console → Settings → Integrations。可用 apify info --user-agent apify-awesome-skills/apify-ecommerce 验证认证。
工作流分五步:
- 检测意图并选择 Actor。若检测到多个意图,需询问用户选择哪一个。
- 获取 Actor schema:用 apify actors info 获取摘要、输入 schema 和 README。注意 --input 不要加 --json,否则会返回约 250 KB 的完整对象而非干净 schema。
- 询问用户偏好:输出格式(快速答案 / CSV / JSON)与结果数量。各意图默认值:定价 50 个商品、评论 200 条、畅销榜 100 项、卖家 50 个、店铺抓取不限、外卖 50 家餐厅、其他 20–50。
- 运行 Actor 并获取结果:apify actors call 阻塞至完成,返回 run 元数据,从中取 defaultDatasetId;再用 apify datasets get-items 按格式获取数据。
- 分析结果并给出整合答案,而非直接倾倒数据。
CLI 规则:始终传递 --user-agent apify-awesome-skills/apify-ecommerce、--json(或 datasets get-items 对应的 --format 标志)以及 2>/dev/null。--user-agent 标志对遥测至关重要,不可省略。
主 Actor 输入速查:定价(关键词)用 {"keyword": "wireless earbuds", "marketplaces": ["www.amazon.com"], "maxProductResults": 50};定价(指定 URL)用 detailsUrls;店铺抓取(分类页)用 listingUrls;评论用 keywordReviews + marketplacesReviews + sortReview + maxReviewResults;卖家用 sellerUrls + maxSellerResults;Google Shopping 用 searchEngineKeyword + countryCode + maxSearchEngineResults;外卖用 keywordDelivery + marketplacesDelivery + addressDelivery + maxDeliveryResults。
适用场景
适合需要跨平台电商数据采集与分析的用户,例如比价、评论情感分析、畅销榜追踪、卖家发现、店铺全量抓取、技术栈识别、SEO 审计、竞品漏斗与定价分析、搜索意图分类、商品跨平台匹配、外卖餐厅信息、活动与房地产信息、广告情报、分类信息、汽车信息、Pinterest 内容发现、TikTok Shop 创作者、网站交易市场等。
限制与注意事项
- 主 Actor 没有 maxResults 字段,其上限按模式区分(maxProductResults、maxReviewResults、maxSellerResults、maxSearchEngineResults、maxDeliveryResults)。设置 maxResults 无效,会导致无限制抓取。
- 成本安全:始终在输入中设置合理的结果上限;运行 1000+ 结果的大规模抓取前应警告用户,因为会消耗更多 Apify 积分。
- apify actors call -i 要求单行有效 JSON;含 URL 数组或引号的输入应写入文件并用 -i @input.json,避免 shell 引号静默破坏复杂输入。
- datasets get-items 始终通过网络流式传输;应先保存到文件(> file.json),再对文件运行 jq,避免重复下载。
- apify actors search --sort-by popularity 会忽略相关性,返回大牌抓取器;升级发现时应保留默认相关性排序,并按 stats.totalUsers / actorReviewRating 过滤。
- 错误处理:认证错误运行 apify login 或设置 APIFY_TOKEN;Actor 未找到检查 ID 拼写;运行 FAILED 打开 console URL 查看日志;超时用 --timeout <seconds>;无结果则扩大关键词、切换备用 Actor,再使用升级发现命令;需要代理则在输入中加入 "proxy": {"useApifyProxy": true};平台未检测到则默认使用 apify/e-commerce-scraping-tool 与通用意图。
- 关于收费、价格、具体平台覆盖范围等未在资料中明确说明的内容,暂未提供。