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

inki-music-api

v2.0.7

Published

lx-music 自定义源 TypeScript + axios 封装,支持 MusicApi class 与外部源加载

Readme

inki-music-api

inki-music-api 是基于 TypeScript + axios 的 lx-music 自定义源封装包,核心导出 MusicApi class,支持:

  • 统一配置化初始化
  • 必须显式加载 source(本地/远程/代码)
  • 外部源文件/代码动态加载
  • musicUrl 走源脚本,其它接口走内置聚合实现

安装

npm install

快速开始

const { MusicApi } = require('inki-music-api');

async function main() {
  const api = new MusicApi();
  await api.loadSourceFromFile('./your-source.js');

  const result = await api.search('kw', '周杰伦', { page: 1, limit: 5 });
  const first = result.list[0];

  const url = await api.getMusicUrl('kw', first, '128k');
  const lyric = await api.getLyric('kw', first);
  const pic = await api.getPic('kw', first);
  const hot = await api.getHot('kw', { page: 1, limit: 5 });
  const rank = await api.getRank('kw', 'hot', { page: 1, limit: 5 });

  console.log(url, lyric, pic, hot.total, rank.total);
}

main();

配置项

type MusicApiConfig = {
  initTimeout?: number;
  requestTimeout?: number;
  followMaxRedirects?: number;
  rejectUnauthorized?: boolean;
  retry?: {
    retries?: number;
    retryDelayMs?: number;
    retryStatusCodes?: number[];
    retryErrorCodes?: string[];
  };
  cache?: {
    enabled?: boolean;
    ttlMs?: number;
    maxEntries?: number;
  };
};

默认配置:

{
  initTimeout: 15000,
  requestTimeout: 15000,
  followMaxRedirects: 5,
  rejectUnauthorized: false,
  retry: {
    retries: 2,
    retryDelayMs: 200,
    retryStatusCodes: [429, 500, 502, 503, 504],
    retryErrorCodes: ['ECONNRESET', 'ECONNABORTED', 'ETIMEDOUT', 'EAI_AGAIN']
  },
  cache: {
    enabled: true,
    ttlMs: 30000,
    maxEntries: 1000
  }
}

加载外部源

const api = new MusicApi();

await api.loadSourceFromFile('./my-source.js');
// 或
await api.loadSourceFromCode(sourceCode);

API

  • init()
  • updateConfig(partialConfig)
  • loadSourceFromFile(filePath)
  • loadSourceFromCode(code)
  • loadSourceFromRemote(url, options)
  • loadSourceFormRemote(url, options)
  • loadSourceFormRmote(url, options)
  • setSource(sourceInstance)
  • getSupportedPlatforms()
  • getCapabilities(source?)
  • getSupportedSourceList()
  • search(source, keywords, { page, limit })
  • searchMusic({ name, singer, source, limit })
  • findMusic({ name, singer, albumName, interval, source })
  • getMusicUrl(source, musicInfo, quality)
  • getLyric(source, musicInfo)
  • getPic(source, musicInfo)
  • getHot(source, { page, limit })
  • getRank(source, rankType, { page, limit })
  • getComment(source, musicInfo, { page, limit })
  • getHotComment(source, musicInfo, { page, limit })
  • getMusicDetailPageUrl(source, musicInfo)
  • getSongListTags(source)
  • getSongList(source, { sortId, tagId, page, limit })
  • getSongListDetail(source, listId, { page, limit })
  • dispatch(source, action, info)
  • clearCache()

开发命令

npm run build
npm run typecheck
npm run lint
npm run format:check
npm test
npm publish