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

hana-music-api

v1.1.1

Published

Modern Netease Cloud Music API package for Node.js.

Readme

hana-music-api

hana-music-api 是一个第三方网易云音乐 API 库,可直接在代码里调用,也可以作为 Bun 服务自行部署。

安装

npm install hana-music-api

SDK 运行环境:

  • Node.js >=24
  • ESM 项目

直接调用

最省事的方式是先创建一个 client:

import { createHanaMusicApi } from 'hana-music-api'

const hana = createHanaMusicApi({
  cookie: 'MUSIC_U=your-cookie',
})

const result = await hana.search({
  keywords: '周杰伦',
  limit: 5,
})

console.log(result.body)

如果你只想调少量接口,也可以直接导入单个函数:

import { songUrl } from 'hana-music-api'

const result = await songUrl(
  {
    id: '347230',
  },
  {
    cookie: 'MUSIC_U=your-cookie',
  },
)

console.log(result.body)

如果模块名来自运行时字符串,可以用 invokeModule()

import { invokeModule } from 'hana-music-api'

const result = await invokeModule(
  'user_account',
  {},
  {
    cookie: 'MUSIC_U=your-cookie',
  },
)

console.log(result.body)

启动 HTTP 服务

如果你想自己部署服务,可以直接运行仓库里的 Bun 服务:

bun install --frozen-lockfile
bun start

默认地址:

  • 服务首页:http://127.0.0.1:3021/
  • 文档:http://127.0.0.1:3021/docs
  • 健康检查:http://127.0.0.1:3021/health

快速试一下:

curl "http://127.0.0.1:3021/search?keywords=周杰伦&limit=5"

常用入口

  • createHanaMusicApi():适合连续调用多个接口
  • camelCase 原始函数:适合按需导入少量接口
  • invokeModule():适合动态模块名场景

常见注意事项

  • 账号信息、歌单管理、云盘、私信、签到这类接口通常需要有效 Cookie
  • SDK 调用时,把 cookieproxyfetcher 这类执行配置放到 config,不要混进业务参数
  • 轮询二维码状态、刷新登录状态这类请求,建议带上时间戳,避免拿到缓存结果
  • 如果遇到区域限制或 460 一类问题,可以尝试 proxyrealIP
  • 这是第三方非官方实现,少数接口会跟着网易云上游变化

文档