提交 679be3df 编写于 作者: B binaryify

首页-发现接口增加 cursor 参数,refresh默认设为false #1217

上级 e35a44e9
# 更新日志
### 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)
......
......@@ -260,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`
......@@ -1502,7 +1502,9 @@ mp3url 不能直接用 , 可通过 `/song/url` 接口传入歌曲 id 获取具
**接口地址 :** `/homepage/block/page`
**可选参数 :** `refresh`: 是否刷新数据,默认为true
**可选参数 :** `refresh`: 是否刷新数据,默认为false
`cursor`: 上一条数据返回的cursor
### 首页-发现-圆形图标入口列表
......@@ -1934,7 +1936,7 @@ mp3url 不能直接用 , 可通过 `/song/url` 接口传入歌曲 id 获取具
### 获取歌曲详情
说明 : 调用此接口 , 传入音乐 id(支持多个 id, 用 `,` 隔开), 可获得歌曲详情(注意:歌曲封面现在需要通过专辑内容接口获取)
说明 : 调用此接口 , 传入音乐 id(支持多个 id, 用 `,` 隔开), 可获得歌曲详情
**必选参数 :** `ids`: 音乐 id, 如 `ids=347230`
......@@ -1942,8 +1944,7 @@ mp3url 不能直接用 , 可通过 `/song/url` 接口传入歌曲 id 获取具
**调用例子 :** `/song/detail?ids=347230`,`/song/detail?ids=347230,347231`
返回数据如下图 :
![获取歌曲详情](https://raw.githubusercontent.com/Binaryify/NeteaseCloudMusicApi/master/static/songDetail.png)
### 获取专辑内容
......@@ -1955,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, 可获得专辑动态信息,如是否收藏,收藏数,评论数,分享数
......
......@@ -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(
......
......@@ -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`,
......
......@@ -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,
......
{
"name": "NeteaseCloudMusicApi",
"version": "4.0.11",
"version": "4.0.12",
"description": "网易云音乐 NodeJS 版 API",
"scripts": {
"start": "node app.js",
......
<!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>
<!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>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册