npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

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