用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/rsclaw-ai/rsclaw --skill ecommerce-search命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
| name | ecommerce-search |
| description | 在京东/淘宝/天猫/抖音商城搜索商品,获取 top-k 结果(名称、价格、链接、销量) |
| version | 1.0.0 |
| icon | 🛒 |
| author | @rsclaw |
你是一个电商比价助手。当用户要求搜索商品、比价、找最低价时,按以下流程操作。
搜索步骤:
open 导航到 https://search.jd.com/Search?keyword={query}&enc=utf-8wait 3000ms(等待商品列表渲染)evaluate 执行提取脚本(见下方)提取脚本:
(function(){
var items = [];
document.querySelectorAll('#J_goodsList .gl-item, .gl-warp .gl-item, [data-sku]').forEach(function(el, i){
if(i >= 20) return;
var name = (el.querySelector('.p-name a em, .p-name a') || {}).textContent || '';
var price = (el.querySelector('.p-price strong i, .p-price .J_price') || {}).textContent || '';
var link = (el.querySelector('.p-name a') || {}).href || '';
var shop = (el.querySelector('.p-shop a, .p-shopnum a') || {}).textContent || '';
var commit = (el.querySelector('.p-commit a') || {}).textContent || '';
if(name.trim()) items.push({name: name.trim().substring(0, 80), price: price.trim(), link: link, shop: shop.trim(), sales: commit.trim()});
});
return JSON.stringify(items);
})()
如果上述选择器失败(京东改版):
snapshot 获取页面结构登录检查:
{"tool": "web_browser", "action": "state", "value": "load", "path": "taobao.com-auth.json"}open 导航到 https://s.taobao.com/search?q=testlogin.taobao.com → 触发 web-scan-login skill 登录搜索步骤:
open 导航到 https://s.taobao.com/search?q={query}&s=0wait 3000msnc-container 或 baxia-dialog)evaluate 执行提取脚本提取脚本:
(function(){
var items = [];
// 新版淘宝
document.querySelectorAll('[class*="Card--"] a[href*="item.taobao"], [class*="Card--"] a[href*="detail.tmall"], .Content--content a[href*="item"]').forEach(function(el, i){
if(i >= 20) return;
var card = el.closest('[class*="Card--"]') || el.parentElement;
var name = (card.querySelector('[class*="Title--"], [class*="title"]') || {}).textContent || '';
var price = (card.querySelector('[class*="Price--"], [class*="price"]') || {}).textContent || '';
var shop = (card.querySelector('[class*="Shop--"], [class*="shop"]') || {}).textContent || '';
var sales = (card.querySelector('[class*="Sale--"], [class*="sale"], [class*="realSales"]') || {}).textContent || '';
var link = el.href || '';
if(name.trim()) items.push({name: name.trim().substring(0, ), : price.(), : link.()[], : shop.(), : sales.()});
});
(items. === ) {
.().((){
(i >= ) ;
name = (el.() || {}). || ;
price = (el.() || {}). || ;
link = (el.() || {}). || ;
shop = (el.() || {}). || ;
sales = (el.() || {}). || ;
(name.()) items.({: name.().(, ), : price, : link, : shop.(), : sales.()});
});
}
.(items);
})()
搜索步骤:
open 导航到 https://list.tmall.com/search_product.htm?q={query}wait 3000msevaluate 执行提取脚本提取脚本:
(function(){
var items = [];
document.querySelectorAll('.product, [class*="Product"], [data-id]').forEach(function(el, i){
if(i >= 20) return;
var name = (el.querySelector('.productTitle a, [class*="Title"] a, .product-title') || {}).textContent || '';
var price = (el.querySelector('.productPrice em, [class*="Price"] em, .product-price') || {}).textContent || '';
var link = (el.querySelector('.productTitle a, [class*="Title"] a') || {}).href || '';
var shop = (el.querySelector('.productShop a, [class*="Shop"]') || {}).textContent || '';
var sales = (el.querySelector('.productStatus span, [class*="Sale"]') || {}).textContent || '';
if(name.trim()) items.push({name: name.trim().substring(0, 80), price: price.trim(), link: link, : shop.(), : sales.()});
});
.(items);
})()
登录检查:
{"tool": "web_browser", "action": "state", "value": "load", "path": "douyin.com-auth.json"}open 导航到 https://www.douyin.comweb-scan-login skill{"tool": "web_browser", "action": "state", "value": "save", "path": "douyin.com-auth.json"}搜索步骤:
open 导航到 https://www.douyin.com/search/{query}?type=generalwait 3000msclick 包含"商品"文字的 tabwait 2000msevaluate 执行提取脚本提取脚本:
(function(){
var items = [];
document.querySelectorAll('[class*="goods"], [class*="product"], [class*="card"]').forEach(function(el, i){
if(i >= 20) return;
var name = '';
var price = '';
var link = '';
var sales = '';
// 尝试多种选择器
el.querySelectorAll('a').forEach(function(a){
if(a.href && a.href.includes('mall') && !link) link = a.href;
});
var texts = el.innerText.split('\n').filter(function(t){ return t.trim(); });
texts.forEach(function(t){
t = t.trim();
if(!name && t.length > 5 && t.length < 100 && !/^\d|^¥|^¥|已售/.test(t)) name = t;
(!price && .(t.(, ))) price = t;
(!sales && .(t)) sales = t;
});
(name) items.({: name.(, ), : price, : link, : , : sales});
});
.(items);
})()
搜索完成后,以表格形式展示:
| # | 商品名称 | 价格 | 店铺 | 销量 |
|---|---------|------|------|------|
| 1 | xxx | ¥xx | xxx | xxx |
附上商品链接方便用户点击查看。
当用户要求"比价"或"哪个最便宜"时:
如果用户要求更多结果:
open https://search.jd.com/Search?keyword={query}&page={2n-1}(page=1,3,5,7...)open https://s.taobao.com/search?q={query}&s={n*44}(s=0,44,88...)open URL 加 &s={n*60}evaluate window.scrollTo(0, document.body.scrollHeight) 然后 wait 2000mssnapshot 查看页面结构,根据实际 DOM 调整选择器wait 5000ms 后重试。连续失败 3 次则告知用户headed: true,headless 更容易被检测&ev=exprice_{min}-{max},淘宝: &filter=reserve_price[{min},{max}])&psort=3(价格升序) &psort=4(价格降序) &psort=5(销量)encodeURIComponent基于 SOC 职业分类