UNPKG

focus-product-extractor2

Version:

Extract product information from chat/order data

60 lines (53 loc) 1.53 kB
# Focus Product Extractor ## 功能特性 - 支持从聊天记录/订单数据中提取商品信息 - 支持多平台:淘宝、京东、拼多多、Shopee、TikTok等 - 灵活的规则引擎配置 - 标准化输出格式 - 支持商品中心API调用获取详细信息 ## 安装 ```bash npm install focus-product-extractor2 ``` ## 使用 ```javascript 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 ## 发布 ```bash 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 ```