focus-product-extractor2
v2.0.4
Published
Extract product information from chat/order data
Readme
Focus Product Extractor
功能特性
- 支持从聊天记录/订单数据中提取商品信息
- 支持多平台:淘宝、京东、拼多多、Shopee、TikTok等
- 灵活的规则引擎配置
- 标准化输出格式
- 支持商品中心API调用获取详细信息
安装
npm install focus-product-extractor2使用
const extractor = require('focus-product-extractor2');
const result = await extractor.process({
scene: "chat",
platform: "tb",
shopId: "your_shop_id",
rawData: {
messages: [/* 消息数据 */]
},
authConfig: { // 可选,用于API调用
taobaoAuth: "your_auth_token",
domesticAuth: "your_domestic_auth"
}
});
const result = extractor.extract(input);
console.log(result);核心模块
InputAdapter
- 输入数据解析和标准化
- 支持多种消息类型:文本、图片、卡片、转接消息等
RuleEngine
- 基于场景和来源的过滤规则
- 可配置的过滤条件
CoreExtractor
- 核心提取逻辑
- 支持URL解析和商品ID提取
- 自定义规则匹配
OutputStandard
- 输出标准化
- 商品中心API集成
- 多平台商品信息统一格式
依赖
- lodash: ^4.17.21
发布
1️⃣:发布时记得将package.json中的 "type": "module", 改为"type": "commonjs"
2️⃣:开发时记得将package.json中的 "type": "commonjs", 改为"type": "module" (有时间再改进)
npm version patch
npm run prepublishOnly && npm publish --registry=https://registry.npmjs.org