Skip to content

Commit

Permalink
Merge pull request #1 from Binaryify/master
Browse files Browse the repository at this point in the history
同一天
  • Loading branch information
LanHuangJG authored Jul 31, 2023
2 parents 0ff32ac + c505cf4 commit 403d946
Show file tree
Hide file tree
Showing 13 changed files with 4,256 additions and 4,122 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x, 14.x, 16.x, 18.x ]
node-version: [14.x, 16.x, 18.x ]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
Expand Down
14 changes: 14 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
# 更新日志
### 4.9.0 | 2023.07.20
- 新增沉浸环绕声音质,修改部分文案以同步客户端更改 #1760

- 增加对鲸云臻音、鲸云母带音质的支持 #1731

- 新增星评馆简要评论获取接口 #1770

- 更新 song_detail 返回值类型 #1772

- NodeJS 环境要求提高至 v14

### 4.8.11 | 2023.05.29
- 支持headers不携带cookie信息

### 4.8.10 | 2023.04.07
- 补充私信和通知接口

Expand Down
2 changes: 1 addition & 1 deletion README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

## 环境要求

需要 NodeJS 12+ 环境
需要 NodeJS 14+ 环境

## 安装

Expand Down
49 changes: 46 additions & 3 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,8 @@ $ sudo docker run -d -p 3000:3000 netease-music-api

!> 分页接口返回字段里有`more`,more 为 true 则为有下一页

!> 如果不需要接口headers携带cookies信息,可以加上noCookie参数,如`?noCookie=true`

### 登录

说明 : 登录有三个接口,建议使用`encodeURIComponent`对密码编码或者使用`POST`请求,避免某些特殊字符无法解析,如`#`(`#`在 url 中会被识别为 hash,而不是 query)
Expand Down Expand Up @@ -559,7 +561,7 @@ v3.30.0 后支持手动传入 cookie,登录接口返回内容新增 `cookie` 字

##### 3. 二维码检测扫码状态接口

说明: 轮询此接口可获取二维码扫码状态,800 为二维码过期,801 为等待扫码,802 为待确认,803 为授权登录成功(803 状态码下会返回 cookies)
说明: 轮询此接口可获取二维码扫码状态,800 为二维码过期,801 为等待扫码,802 为待确认,803 为授权登录成功(803 状态码下会返回 cookies),如扫码后返回502,则需加上noCookie参数,如`&noCookie=true`

必选参数: `key`,由第一个接口生成

Expand Down Expand Up @@ -1458,7 +1460,8 @@ tags: 歌单标签

**必选参数 :** `id` : 音乐 id
`level`: 播放音质等级, 分为 `standard` => `标准`,`higher` => `较高`, `exhigh`=>`极高`,
`lossless`=>`无损`, `hires`=>`Hi-Res`, `jyeffect` => `鲸云臻音`, `jymaster` => `鲸云母带`
`lossless`=>`无损`, `hires`=>`Hi-Res`, `jyeffect` => `高清环绕声`, `sky` => `沉浸环绕声`,
`jymaster` => `超清母带`

**接口地址 :** `/song/url/v1`

Expand Down Expand Up @@ -1668,6 +1671,35 @@ tags: 歌单标签

相关讨论可见: [Issue](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/1667)

**歌词格式解析 :**

当逐字歌词适用时,`yrc``lyric`字段包括形式如下的内容
* (可能存在)JSON 歌曲元数据
```
{"t":0,"c":[{"tx":"作曲: "},{"tx":"柳重言","li":"http://p1.music.126.net/Icj0IcaOjH2ZZpyAM-QGoQ==/6665239487822533.jpg","or":"orpheus://nm/artist/home?id=228547&type=artist"}]}
{"t":5403,"c":[{"tx":"编曲: "},{"tx":"Alex San","li":"http://p1.music.126.net/pSbvYkrzZ1RFKqoh-fA9AQ==/109951166352922615.jpg","or":"orpheus://nm/artist/home?id=28984845&type=artist"}]}
{"t":10806,"c":[{"tx":"制作人: "},{"tx":"王菲","li":"http://p1.music.126.net/1KQVD6XWbs5IAV0xOj1ZIA==/18764265441342019.jpg","or":"orpheus://nm/artist/home?id=9621&type=artist"},{"tx":"/"},{"tx":"梁荣骏","li":"http://p1.music.126.net/QrD8drwrRcegfKLPoiiG2Q==/109951166288436155.jpg","or":"orpheus://nm/artist/home?id=189294&type=artist"}]}
```
该字段不一定出现;可能出现的数据意义有:
- `t` : 数据显示开始时间戳 (毫秒)
- `c` : 元数据list
- `tx`: 文字段
- `li`: 艺术家、歌手头像图url
- `or`:云音乐app内路径;例中作用即打开艺术家主页
* 逐字歌词
```
[16210,3460](16210,670,0)还(16880,410,0)没...
~~~~1 ~~~2 ~~~~3 ~~4 5 ~6 (...)
```
由标号解释:
1. 歌词行显示开始时间戳 (毫秒)
2. 歌词行显示总时长(毫秒)
3. 逐字显示开始时间戳 (毫秒)
4. 逐字显示时长 (厘秒/0.01s)
5. 未知
6. 文字

`yrc``version`字段貌似与`lyric`字段格式无关

### 新歌速递

Expand Down Expand Up @@ -2676,7 +2708,13 @@ pc: 云盘歌曲信息,如果不存在该字段,则为非云盘歌曲
**接口地址 :** `/program/recommend`
**调用例子 :** `/program/recommend`
**可选参数 :**
`limit`: 取出数量 , 默认为 10
`offset`: 偏移数量 , 用于分页 , 如 :( 页数 -1)\*10, 其中 10 为 limit 的值 , 默认
为 0
**调用例子 :** `/program/recommend?limit=5`
### 独家放送(入口列表)
Expand Down Expand Up @@ -4076,6 +4114,11 @@ type='1009' 获取其 id, 如`/search?keywords= 代码时间 &type=1009`
**调用例子:** `/style/artist?tagId=1000`
### 云村星评馆 - 简要评论
说明: 调用此接口可以获取首页推荐的星评馆评论信息
**接口地址:** `/starpick/comments/summary`
## 离线访问此文档
Expand Down
90 changes: 87 additions & 3 deletions interface.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ export interface APIBaseResponse {
[index: string]: unknown
}

export interface Response {
export interface Response<Body = APIBaseResponse> {
status: number // The Http Response Code
body: APIBaseResponse // API Response body
body: Body // API Response body
cookie: string[]
}

Expand Down Expand Up @@ -1050,7 +1050,91 @@ export function simi_user(

export function song_detail(
params: { ids: string } & RequestBaseConfig,
): Promise<Response>
): Promise<
Response<{
songs: SongDetail[]
privileges: unknown[]
code: number
}>
>

type SongDetail = {
name: string
id: number
pst: number
t: number
ar: SongDetailArtist[]
alia: string[]
pop: number
st: number
rt: string | null
fee: SongDetailFee
v: number
crbt: string | null
cf: string
al: SongDetailAlbum
dt: number
h: SongDetailQuality | null
m: SongDetailQuality | null
l: SongDetailQuality | null
sq: SongDetailQuality | null
hr: unknown
a: unknown | null
cd: string
no: number
rtUrl: unknown | null
ftype: number
rtUrls: unknown[]
djId: number
copyright: SongDetailCopyright
s_id: number
mark: number
originCoverType: SongDetailOriginCoverType
originSongSimpleData: unknown | null
tagPicList: unknown | null
resourceState: boolean
version: number
songJumpInfo: unknown | null
entertainmentTags: unknown | null
awardTags: unknown | null
single: number
noCopyrightRcmd: unknown | null
mv: number
rtype: number
rurl: unknown | null
mst: number
cp: number
publishTime: number
}

type SongDetailArtist = {
id: number
name: string
tns: unknown[]
alias: unknown[]
}

type SongDetailFee = 0 | 1 | 4 | 8

type SongDetailAlbum = {
id: number
name: string
picUrl: string
tns: unknown[]
pic: number
}

type SongDetailQuality = {
br: number
fid: number
size: number
vd: number
sr: number
}

type SongDetailCopyright = 0 | 1 | 2

type SongDetailOriginCoverType = 0 | 1 | 2

export function song_order_update(
params: { pid: string | number; ids: string } & RequestBaseConfig,
Expand Down
7 changes: 6 additions & 1 deletion module/song_url_v1.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
// 歌曲链接 - v1
// 此版本不再采用 br 作为音质区分的标准
// 而是采用 standard, exhigh, lossless, hires, jyeffect, jymaster 进行音质判断
// 而是采用 standard, exhigh, lossless, hires, jyeffect(高清环绕声), sky(沉浸环绕声), jymaster(超清母带) 进行音质判断

const crypto = require('crypto')
module.exports = (query, request) => {
query.cookie.os = 'android'
query.cookie.appver = '8.10.05'
const data = {
ids: '[' + query.id + ']',
level: query.level,
encodeType: 'flac',
}
if (data.level == 'sky') {
data.immerseType = 'c51'
}
console.log(data)
return request(
'POST',
`https://interface.music.163.com/eapi/song/enhance/player/url/v1`,
Expand Down
22 changes: 22 additions & 0 deletions module/starpick_comments_summary.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// 云村星评馆 - 简要评论列表
module.exports = (query, request) => {
const data = {
cursor: JSON.stringify({
offset: 0,
blockCodeOrderList: ['HOMEPAGE_BLOCK_NEW_HOT_COMMENT'],
refresh: true,
}),
}
return request(
'POST',
`https://interface3.music.163.com/eapi/homepage/block/page`,
data,
{
crypto: 'eapi',
cookie: query.cookie,
proxy: query.proxy,
url: '/api/homepage/block/page',
realIP: query.realIP,
},
)
}
Loading

1 comment on commit 403d946

@vercel
Copy link

@vercel vercel bot commented on 403d946 Jul 31, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.