|
6 months ago | |
---|---|---|
.github | 6 months ago | |
.husky | 6 months ago | |
data | 6 months ago | |
examples | 6 months ago | |
module | 6 months ago | |
module_example | 6 months ago | |
plugins | 6 months ago | |
public | 6 months ago | |
test | 6 months ago | |
util | 6 months ago | |
.dockerignore | 6 months ago | |
.editorconfig | 6 months ago | |
.eslintrc.js | 6 months ago | |
.gitignore | 6 months ago | |
.npmignore | 6 months ago | |
.prettierrc | 6 months ago | |
.travis.yml | 6 months ago | |
CHANGELOG.MD | 6 months ago | |
Dockerfile | 6 months ago | |
LICENSE | 6 months ago | |
README.MD | 6 months ago | |
app.js | 6 months ago | |
generateConfig.js | 6 months ago | |
index.js | 6 months ago | |
interface.d.ts | 6 months ago | |
issue_template.md | 6 months ago | |
main.js | 6 months ago | |
main.test.js | 6 months ago | |
package-lock.json | 6 months ago | |
package.json | 6 months ago | |
renovate.json | 6 months ago | |
scf_bootstrap | 6 months ago | |
server.js | 6 months ago | |
server.test.js | 6 months ago | |
tsconfig.json | 6 months ago | |
vercel.json | 6 months ago | |
yarn.lock | 6 months ago |
网易云音乐 Node.js API service
需要 NodeJS 14+ 环境
$ git clone git@gitlab.com:Binaryify/NeteaseCloudMusicApi.git
$ cd NeteaseCloudMusicApi
$ npm install
或者
$ git clone https://gitlab.com/Binaryify/NeteaseCloudMusicApi.git
$ cd NeteaseCloudMusicApi
$ npm install
调用前务必阅读文档的调用前须知
$ node app.js
服务器启动默认端口为 3000,若不想使用 3000 端口,可使用以下命令: Mac/Linux
$ PORT=4000 node app.js
windows 下使用 git-bash 或者 cmder 等终端执行以下命令:
$ set PORT=4000 && node app.js
可在终端直接执行
npx NeteaseCloudMusicApi@latest
使用此命令,可直接启动服务,无需下载或者 clone 项目
v4.0.8 加入了 Vercel 配置文件,可以直接在 Vercel 下部署了,不需要自己的服务器
New Project
Import Git Repository
并选择你 fork 的此项目并点击import
PERSONAL ACCOUNT
的 select
Continue
PROJECT NAME
自己填,FRAMEWORK PRESET
选 Other
然后直接点 Deploy
接着等部署完成即可因 Vercel
在国内访问太慢,在此提供腾讯云 serverless 部署方法(注意:腾讯云 serverless 并不是免费的,前三个月有免费额度,之后收费)
新建应用
创建方式
选择 Web 应用
Express框架
,点击底部下一步按钮
应用名
,上传方式选择代码仓库
,进行 GitHub 授权(如已授权可跳过这一步),代码仓库选择刚刚 fork 的项目启动文件填入:
#!/bin/bash
export PORT=9000
/var/lang/node16/bin/node app.js
点击完成
,等待部署完成,点击资源列表
的 API网关
里的 URL
,正常情况会打开文档地址,点击文档例子
可查看接口调用效果
v3.31.0 后支持 Node.js 调用,导入的方法为module
内的文件名,返回内容包含status
和body
,status
为状态码,body
为请求返回内容,参考module_example
文件夹下的 test.js
const { login_cellphone, user_cloud } = require('NeteaseCloudMusicApi')
async function main() {
try {
const result = await login_cellphone({
phone: '手机号',
password: '密码',
})
console.log(result)
const result2 = await user_cloud({
cookie: result.body.cookie, // 凭证
})
console.log(result2.body)
} catch (error) {
console.log(error)
}
}
main()
// test.ts
import { banner } from 'NeteaseCloudMusicApi'
banner({ type: 0 }).then((res) => {
console.log(res)
})
$ npm test
语言 | 作者 | 地址 | 类型 |
---|---|---|---|
Java | JackuXL | https://github.com/JackuXL/NeteaseCloudMusicApi-SDK | 第三方 |
Java | 1015770492 | https://github.com/1015770492/yumbo-music-utils | 第三方 |
Python | 盧瞳 | NeteaseCloudMusic_PythonSDK | 第三方 |