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 🙏

© 2024 – Pkg Stats / Ryan Hefner

netease-music-sdk

v0.3.3

Published

NetEast Music SDK, Simple & Quickly & Powerful

Downloads

18

Readme

Netease-Music-SDK

npm npm

网易云音乐 Node.js 版本 SDK,反正估计只有国内会用,我也就懒得用英文了。

由于发现市面上很多类似的 API 都是提供的 API 服务,而不是说 SDK,或者是很多都年久失修,所以才诞生了这个项目。 希望提供纯净可靠方便的 Node.js SDK,方便其他人进行二次开发。

本项目所有的接口来源于 NeteaseCloudMusicApi,希望大家可以支持原作者。 本人只是在上面的基础上进行了相关的封装和抽离。如果发现接口有问题,请先向原作者提交 issue,然后跟我说明,我会跟进。

进度

  • [x] 专辑(已单测)
  • [x] 歌手(已单测)
  • [x] 轮播图(已单测)
  • [x] 评论
  • [x] 电台(已单测)
  • [x] 登录
  • [x] 音乐(已单测)
  • [x] 个人推荐(已单测)
  • [x] 歌单
  • [x] 推荐系统
  • [x] 搜索(已单测)
  • [x] 相似推荐(已单测)
  • [x] 最热(已单测)
  • [x] 用户
  • [x] MV(已单测)
  • [x] 私信

安装

npm install netease-music-sdk

Quick Start

使用很简单,直接引入 MusicClient 然后实例化之后就可以使用了。 采用 Typescript 开发,并且 Document In Code,更多介绍,请查看 SDK 文档 以及 .d.ts

有一些请求接口需要登录之后才能访问,所以请在调用登录之后访问这些接口,否则会报错。

const { MusicClient } = require('netease-music-sdk')
const client = new MusicClient()

client.getPlaylistCatalogue().then(cate => {
    // blah blah
})

// 或者可以登录之后操作与用户相关的内容,现在暂时只能用手机号登录
// 邮箱登录需要等原作者修复,修复之后我会自动跟进

client.phoneLogin('phone', 'pwd').then(() => {
    // 当用户登录成功之后,会将 cookie 保存到 client.cookie
    // 如果需要,请大家手动将 cookie dump 到本地
    return client.getPersonalFM()
}).then(fm => {
    console.dir(fm)
}).catch(e => {
    // 登录失败啊,需要登录权限啊,等等错误
})

登录与恢复

因为对于网易云来说,用户的登录与管理是至关重要的一件事情,通过 client.phoneLogin 或者 client.emailLogin 登录。 之后可以通过 client.user 来获取一些用户信息,比如 id,昵称等。更多请查看 docs。

client.user 只有在登录之后才有效,否则会是 undefined

当你再次声明一个新的对象的时候,可能需要恢复登录信息,那么可以通过将 const store = oldClient.user.toJSON() 导出登录信息。 在新的对象上调用 newClient.load(store) 恢复登录信息。调用 load 之后也会让 client.user 可用。

API

SDK 接口文档: http://netease-music-sdk.xgheaven.com

ChangeLog

ChangeLog

Thanks

欢迎提交 issue 已经 PR