Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update #2

Merged
merged 4 commits into from
May 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
# 更新日志
### 4.0.12 | 2021.5.1
- 首页-发现接口增加 cursor 参数,refresh默认设为false [#1217](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/1217)

- 更新`song/detail` 接口

### 4.0.11 | 2021.4.26
- 新增云盘歌曲信息匹配纠正接口 [#1212](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/1212)

### 4.0.10 | 2021.4.09
- 新增用户历史评论接口 [#1197](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/1197)

Expand Down
2 changes: 2 additions & 0 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,8 @@ banner({ type:0 }).then(res=>{
202. 歌单详情动态
203. 绑定手机
204. 一起听状态
205. 用户历史评论
206. 云盘歌曲信息匹配纠正

## 更新日志

Expand Down
32 changes: 23 additions & 9 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@
203. 绑定手机
204. 一起听状态
205. 用户历史评论
206. 云盘歌曲信息匹配纠正

## 安装

Expand Down Expand Up @@ -259,7 +260,7 @@ $ set HOST=127.0.0.1 && node app.js
```

## Vercel 部署
v4.0.8 加入了 Vercel 配置文件,可以直接在 Vercel 下部署了,不需要自己的服务器
v4.0.8 加入了 Vercel 配置文件,可以直接在 Vercel 下部署了,不需要自己的服务器(访问Vercel部署的接口,需要额外加一个realIP参数,如 `/song/url?id=191254&realIP=116.25.146.177`)
### 操作方法
1. fork 此项目
2. 在 Vercel 官网点击 `New Project`
Expand Down Expand Up @@ -826,7 +827,8 @@ tags: 歌单标签

**必选参数 :** `uid` : 用户 id

**可选参数 :**
**可选参数 :**

`limit` : 返回数量 , 默认为 10

`time`: 上一条数据的time,第一页不需要传,默认为0
Expand Down Expand Up @@ -1500,7 +1502,9 @@ mp3url 不能直接用 , 可通过 `/song/url` 接口传入歌曲 id 获取具

**接口地址 :** `/homepage/block/page`

**可选参数 :** `refresh`: 是否刷新数据,默认为true
**可选参数 :** `refresh`: 是否刷新数据,默认为false

`cursor`: 上一条数据返回的cursor


### 首页-发现-圆形图标入口列表
Expand Down Expand Up @@ -1932,16 +1936,15 @@ mp3url 不能直接用 , 可通过 `/song/url` 接口传入歌曲 id 获取具

### 获取歌曲详情

说明 : 调用此接口 , 传入音乐 id(支持多个 id, 用 `,` 隔开), 可获得歌曲详情(注意:歌曲封面现在需要通过专辑内容接口获取)
说明 : 调用此接口 , 传入音乐 id(支持多个 id, 用 `,` 隔开), 可获得歌曲详情

**必选参数 :** `ids`: 音乐 id, 如 `ids=347230`

**接口地址 :** `/song/detail`

**调用例子 :** `/song/detail?ids=347230`,`/song/detail?ids=347230,347231`

返回数据如下图 :
![获取歌曲详情](https://raw.githubusercontent.com/Binaryify/NeteaseCloudMusicApi/master/static/songDetail.png)


### 获取专辑内容

Expand All @@ -1953,9 +1956,6 @@ mp3url 不能直接用 , 可通过 `/song/url` 接口传入歌曲 id 获取具

**调用例子 :** `/album?id=32311`

返回数据如下图 :
![获取专辑内容](https://raw.githubusercontent.com/Binaryify/NeteaseCloudMusicApi/master/static/%E4%B8%93%E8%BE%91.png)


### 专辑动态信息
说明 : 调用此接口 , 传入专辑 id, 可获得专辑动态信息,如是否收藏,收藏数,评论数,分享数
Expand Down Expand Up @@ -2631,6 +2631,20 @@ type : 地区

**调用例子 :** `/cloud`

### 云盘歌曲信息匹配纠正
说明 : 登录后调用此接口,可对云盘歌曲信息匹配纠正,如需取消匹配,asid需要传0

**必选参数 :**
`uid`: 用户id

`sid`: 云盘的歌曲id

`asid`: 要匹配的歌曲id

**接口地址 :** `/cloud/match`

**调用例子 :** `/cloud/match?uid=32953014&sid=aaa&asid=bbb` `/cloud/match?uid=32953014&sid=bbb&asid=0`

### 电台banner
说明 : 调用此接口,可获取电台banner

Expand Down
13 changes: 12 additions & 1 deletion interface.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,10 @@ export function history_recommend_songs_detail(
): Promise<Response>

export function homepage_block_page(
params: { refresh?: 'true' | 'false' | boolean } & RequestBaseConfig,
params: {
refresh?: 'true' | 'false' | boolean
cursor?: string
} & RequestBaseConfig,
): Promise<Response>

export function homepage_dragon_ball(
Expand Down Expand Up @@ -1417,3 +1420,11 @@ export function user_comment_history(
time?: number | string
} & RequestBaseConfig,
): Promise<Response>

export function cloud_match(
params: {
uid: number | string
sid: number | string
asid: number | string
} & RequestBaseConfig,
): Promise<Response>
20 changes: 20 additions & 0 deletions module/cloud_match.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
module.exports = (query, request) => {
query.cookie.os = 'ios'
query.cookie.appver = '8.1.20'
const data = {
userId: query.uid,
songId: query.sid,
adjustSongId: query.asid,
}
return request(
'POST',
`https://music.163.com/api/cloud/user/song/match`,
data,
{
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
},
)
}
2 changes: 1 addition & 1 deletion module/homepage_block_page.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
module.exports = (query, request) => {
query.cookie.os = 'ios'
query.cookie.appver = '8.1.20'
const data = { refresh: query.refresh || true }
const data = { refresh: query.refresh || false, cursor: query.cursor }
return request(
'POST',
`https://music.163.com/api/homepage/block/page`,
Expand Down
2 changes: 1 addition & 1 deletion module/song_detail.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = (query, request) => {
const data = {
c: '[' + query.ids.map((id) => '{"id":' + id + '}').join(',') + ']',
}
return request('POST', `https://music.163.com/weapi/v3/song/detail`, data, {
return request('POST', `https://music.163.com/api/v3/song/detail`, data, {
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "NeteaseCloudMusicApi",
"version": "4.0.10",
"version": "4.0.12",
"description": "网易云音乐 NodeJS 版 API",
"scripts": {
"start": "node app.js",
Expand Down
58 changes: 58 additions & 0 deletions public/home.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<!DOCTYPE html>
<html lang="zh">

<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>home</title>
</head>

<body>
<script src="https://cdn.bootcdn.net/ajax/libs/axios/0.20.0-0/axios.min.js"></script>
<script>
const phone = '' // 这里填手机号
const password = '' // 这里填密码
const fileUpdateTime = {}
let cookieToken = ''
if (!phone || !password) {
const msg = '请设置你的手机号码和密码'
alert(msg)
throw new Error(msg)
}

async function login() {
const res = await axios({
url: `/login/cellphone?phone=${phone}&password=${encodeURIComponent(
password,
)}`,
})
cookieToken = res.data.cookie
}
async function main() {
await login()
const res = await axios({
url: `/homepage/block/page`,
data: {
cookie: cookieToken,
},
method: 'post',
})
let cursor = ''
console.log(res.data.data)
if (res.data.data.hasMore) {
cursor = res.data.data.cursor
const res2 = await axios({
url: `/homepage/block/page?time=${Date.now()}`,
data: {
cookie: cookieToken,
cursor: cursor,
},
method: 'post',
})
}
}
main()
</script>
</body>

</html>
47 changes: 47 additions & 0 deletions public/login.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<!DOCTYPE html>
<html lang="zh">

<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>登录</title>
</head>

<body>
<script src="https://cdn.bootcdn.net/ajax/libs/axios/0.20.0-0/axios.min.js"></script>
<script>
const phone = '' // 这里填手机号
const password = '' // 这里填密码
const fileUpdateTime = {}
if (!phone || !password) {
const msg = '请设置你的手机号码和密码'
alert(msg)
throw new Error(msg)
}

async function login() {
const res = await axios({
url: `/login/cellphone`,
method: 'post',
data: {
phone: phone,
password: password,
},
})
return res.data.cookie
}
async function main() {
const cookieToken = await login()
const res = await axios({
url: `/login/status`,
method: 'post',
data: {
cookie: cookieToken,
},
})
}
main()
</script>
</body>

</html>