Skip to content
This repository has been archived by the owner on Apr 16, 2024. It is now read-only.

Commit

Permalink
新增已购单曲,获取mlog播放地址,将mlog id转为视频id,vip成长值,vip成长值获取记录,vip任务,领取vip成长值 等接口 #…
Browse files Browse the repository at this point in the history
  • Loading branch information
Binaryify committed May 29, 2021
1 parent 5494359 commit ea86e5b
Show file tree
Hide file tree
Showing 14 changed files with 141 additions and 157 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# 更新日志
### 4.0.15 | 2021.5.29
- 新增已购单曲,获取mlog播放地址,将mlog id转为视频id,vip成长值,vip成长值获取记录,vip任务,领取vip成长值 等接口 [#1248](https://github.com/Binaryify/NeteaseCloudMusicApi/pull/1248)

### 4.0.14 | 2021.5.28
- 增加云贝推歌接口,云贝推歌历史记录接口 [#1246](https://github.com/Binaryify/NeteaseCloudMusicApi/pull/1246)

Expand Down
5 changes: 3 additions & 2 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ app.use((req, res, next) => {
;(req.headers.cookie || '').split(/\s*;\s*/).forEach((pair) => {
let crack = pair.indexOf('=')
if (crack < 1 || crack == pair.length - 1) return
req.cookies[decodeURIComponent(pair.slice(0, crack)).trim()] =
decodeURIComponent(pair.slice(crack + 1)).trim()
req.cookies[
decodeURIComponent(pair.slice(0, crack)).trim()
] = decodeURIComponent(pair.slice(crack + 1)).trim()
})
next()
})
Expand Down
13 changes: 4 additions & 9 deletions interface.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1429,7 +1429,6 @@ export function cloud_match(
} & RequestBaseConfig,
): Promise<Response>


export function yunbei_rcmd_song(
params: {
id: number | string
Expand Down Expand Up @@ -1461,20 +1460,16 @@ export function mlog_to_video(
} & RequestBaseConfig,
): Promise<Response>

export function vip_growthpoint(
params: RequestBaseConfig,
): Promise<Response>
export function vip_growthpoint(params: RequestBaseConfig): Promise<Response>

export function vip_growthpoint_details(
params: MultiPageConfig & RequestBaseConfig,
): Promise<Response>

export function vip_tasks(
params: RequestBaseConfig,
): Promise<Response>
export function vip_tasks(params: RequestBaseConfig): Promise<Response>

export function vip_growthpoint_get(
params: {
params: {
id?: number | string
} & RequestBaseConfig,
): Promise<Response>
): Promise<Response>
29 changes: 14 additions & 15 deletions module/mlog_to_video.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
// 将mlog id转为video id

module.exports = (query, request) => {
const data = {
mlogId: query.id,
}
return request(
'POST',
`https://music.163.com/weapi/mlog/video/convert/id`,
data,
{
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
},
)
const data = {
mlogId: query.id,
}

return request(
'POST',
`https://music.163.com/weapi/mlog/video/convert/id`,
data,
{
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
},
)
}
28 changes: 11 additions & 17 deletions module/mlog_url.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
// mlog链接

module.exports = (query, request) => {
const data = {
id: query.id,
resolution: query.res || 1080,
type: 1,
}
return request(
'POST',
`https://music.163.com/weapi/mlog/detail/v1`,
data,
{
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
},
)
const data = {
id: query.id,
resolution: query.res || 1080,
type: 1,
}

return request('POST', `https://music.163.com/weapi/mlog/detail/v1`, data, {
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
})
}
3 changes: 1 addition & 2 deletions module/related_playlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ module.exports = (query, request) => {
},
).then((response) => {
try {
const pattern =
/<div class="cver u-cover u-cover-3">[\s\S]*?<img src="([^"]+)">[\s\S]*?<a class="sname f-fs1 s-fc0" href="([^"]+)"[^>]*>([^<]+?)<\/a>[\s\S]*?<a class="nm nm f-thide s-fc3" href="([^"]+)"[^>]*>([^<]+?)<\/a>/g
const pattern = /<div class="cver u-cover u-cover-3">[\s\S]*?<img src="([^"]+)">[\s\S]*?<a class="sname f-fs1 s-fc0" href="([^"]+)"[^>]*>([^<]+?)<\/a>[\s\S]*?<a class="nm nm f-thide s-fc3" href="([^"]+)"[^>]*>([^<]+?)<\/a>/g
let result,
playlists = []
while ((result = pattern.exec(response.body)) != null) {
Expand Down
31 changes: 15 additions & 16 deletions module/song_purchased.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
// 已购单曲

module.exports = (query, request) => {
const data = {
limit: query.limit || 20,
offset: query.offset || 0,
}
return request(
'POST',
`https://music.163.com/weapi/single/mybought/song/list`,
data,
{
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
},
)
const data = {
limit: query.limit || 20,
offset: query.offset || 0,
}

return request(
'POST',
`https://music.163.com/weapi/single/mybought/song/list`,
data,
{
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
},
)
}
27 changes: 13 additions & 14 deletions module/vip_growthpoint.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
// 会员成长值

module.exports = (query, request) => {
const data = {}
return request(
'POST',
`https://music.163.com/weapi/vipnewcenter/app/level/growhpoint/basic`,
data,
{
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
},
)
}

const data = {}
return request(
'POST',
`https://music.163.com/weapi/vipnewcenter/app/level/growhpoint/basic`,
data,
{
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
},
)
}
31 changes: 15 additions & 16 deletions module/vip_growthpoint_details.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
// 会员成长值领取记录

module.exports = (query, request) => {
const data = {
limit: query.limit || 20,
offset: query.offset || 0,
}
return request(
'POST',
`https://music.163.com/weapi/vipnewcenter/app/level/growth/details`,
data,
{
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
},
)
const data = {
limit: query.limit || 20,
offset: query.offset || 0,
}

return request(
'POST',
`https://music.163.com/weapi/vipnewcenter/app/level/growth/details`,
data,
{
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
},
)
}
29 changes: 14 additions & 15 deletions module/vip_growthpoint_get.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
// 领取会员成长值

module.exports = (query, request) => {
const data = {
taskIds: query.id,
}
return request(
'POST',
`https://music.163.com/weapi/vipnewcenter/app/level/task/reward/get`,
data,
{
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
},
)
const data = {
taskIds: query.id,
}

return request(
'POST',
`https://music.163.com/weapi/vipnewcenter/app/level/task/reward/get`,
data,
{
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
},
)
}
27 changes: 13 additions & 14 deletions module/vip_tasks.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
// 会员任务

module.exports = (query, request) => {
const data = {}
return request(
'POST',
`https://music.163.com/weapi/vipnewcenter/app/level/task/list`,
data,
{
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
},
)
}

const data = {}
return request(
'POST',
`https://music.163.com/weapi/vipnewcenter/app/level/task/list`,
data,
{
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
},
)
}
35 changes: 17 additions & 18 deletions module/yunbei_rcmd_song.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
// 云贝推歌

module.exports = (query, request) => {
const data = {
songId: query.id,
reason: query.reason || '好歌献给你',
scene: '',
fromUserId: -1,
}
return request(
'POST',
`https://music.163.com/weapi/yunbei/rcmd/song/submit`,
data,
{
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
},
)
const data = {
songId: query.id,
reason: query.reason || '好歌献给你',
scene: '',
fromUserId: -1,
}

return request(
'POST',
`https://music.163.com/weapi/yunbei/rcmd/song/submit`,
data,
{
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
},
)
}
35 changes: 17 additions & 18 deletions module/yunbei_rcmd_song_history.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
// 云贝推歌历史记录

module.exports = (query, request) => {
const data = {
page: JSON.stringify({
size: query.size || 20,
cursor: query.cursor || '',
})
}
return request(
'POST',
`https://music.163.com/weapi/yunbei/rcmd/song/history/list`,
data,
{
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
},
)
const data = {
page: JSON.stringify({
size: query.size || 20,
cursor: query.cursor || '',
}),
}

return request(
'POST',
`https://music.163.com/weapi/yunbei/rcmd/song/history/list`,
data,
{
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
},
)
}
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.14",
"version": "4.0.15",
"description": "网易云音乐 NodeJS 版 API",
"scripts": {
"start": "node app.js",
Expand Down

2 comments on commit ea86e5b

@vercel
Copy link

@vercel vercel bot commented on ea86e5b May 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on ea86e5b May 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

netease-cloud-music-api – ./docs

netease-cloud-music-api-git-master-binaryify.vercel.app
neteasecloudmusicapi.vercel.app

Please sign in to comment.