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 🙏

© 2025 – Pkg Stats / Ryan Hefner

promise-top-sdk

v1.0.4

Published

淘宝TOP(Taobao Open Platform)SDK

Readme

promise-top-sdk (Taobao TOP API Node SDK)

Axios 实现的阿里开放平台 TOP SDK

NPM Version npm download

  • 支持 Promise
  • Typescript
  • http/https keep alive
  • 默认开启 simplify 返回精简 JSON 格式
  • 自动重试 可配置重试次数,重试间隔,重试条件

参考文档 https://open.taobao.com/doc.htm?docId=101617&docType=1

Get Started

import TopClient from "taobao-top-sdk";

const param = {};
const client = new TopClient({
  appkey: "",
  appsecret: ""
  //REST_URL:"http://gw.api.taobao.com/router/rest"
});
const data = await client.execute("taobao.tbk.dg.material.optional", param);
console.log(data); // {"result_list":[{"category_id":50008881,"category_name"......}

注意事项

默认开启 simplify,返回精简 JSON

目前没有在阿里文档找到 simplify 参数的相关说明,下面是开启后返回 json 对比. 目前观察到的是数组精简掉 "map_data" 和 精简 "接口名称_response"

simplify=true 时

{
  "result_list": [
    {
      ...
      "shop_title": "xxx旗舰店",
      "short_title": "xxx肩带防滑聚拢小无钢圈抹胸",
      "small_images": [
        "https://img.alicdn.com/i2/800648922/O1CN01XDo8R92FmKB0tYu86_!!800648922.jpg",
        "https://img.alicdn.com/i1/800648922/O1CN019jyqEZ2FmKFEQv1k2_!!800648922.jpg"
      ],
      "title": "xxx无肩带文胸防滑聚拢小胸罩抹胸无钢圈蕾丝美背隐形内衣女",
      "x_id": "4H2rEIrvnSnOC7PVBfgv",
      "zk_final_price": "165"
    }
  ],
  "total_results": 903001,
  "request_id": "o7x83wd8zjtg"
}

simplify=false 时

{
  "tbk_dg_material_optional_response": {
    "result_list": {
      "map_data": [
        {
          ...
          "shop_title": "芬斯狄娜旗舰店",
          "short_title": "芬斯狄娜肩带防滑聚拢小无钢圈抹胸",
          "small_images": {
            "string": [
              "https://img.alicdn.com/i2/800648922/O1CN01XDo8R92FmKB0tYu86_!!800648922.jpg",
              "https://img.alicdn.com/i1/800648922/O1CN019jyqEZ2FmKFEQv1k2_!!800648922.jpg"
            ]
          },
          "title": "芬斯狄娜无肩带文胸防滑聚拢小胸罩抹胸无钢圈蕾丝美背隐形内衣女",
          "x_id": "4H2rEIrvnSnOC7PVBfgv",
          "zk_final_price": "165"
        }
      ]
    },
    "total_results": 907240,
    "request_id": "ojpm34kxw0w0"
  }
}

更多设置

import TopClient from "taobao-top-sdk";
const client = new TopClient({
  appkey,
  appsecret,
  REST_URL:"http://gw.api.taobao.com/router/rest" //网关地址
  retryCondition: res => {
    return res.data?.error_response?.sub_code === "50001" || res.status >= 400;
  }, // 重试条件 default: (res)=>{return res.status >= 400} 状态码大于等于400都进行重试
  retries: 10, // 重试次数  default:0 不重试
  retryDelay: 50, // 重试间隔(毫秒) default:0 无间隔
  timeout: 1000, // 超时时间(毫秒) default:0 无超时
  simplify: true // 是否启用精简json default:true 启用
});
const data = await client.execute("taobao.tbk.dg.material.optional", para);
console.log(data);