Merge branch 'add-comment-info' into 'main'

This commit is contained in:
ElyPrism 2026-02-28 15:29:10 +08:00 committed by GitHub
commit 2c82c9b7be
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 95 additions and 3 deletions

View File

@ -0,0 +1,30 @@
// 评论统计数据
// type: 0=歌曲 1=MV 2=歌单 3=专辑 4=电台节目 5=视频 6=动态 7=电台
// ids: 资源 ID 列表,多个用逗号分隔,如 "123,456"
const { resourceTypeMap } = require('../util/config.json')
const createOption = require('../util/option.js')
// 从 resourceTypeMap 的前缀值中提取网易云内部资源类型编号
// 例如 "R_SO_4_" -> "4", "A_DR_14_" -> "14"
const resourceTypeIdMap = Object.fromEntries(
Object.entries(resourceTypeMap).map(([key, prefix]) => [
key,
prefix.replace(/_$/, '').split('_').pop(),
]),
)
module.exports = (query, request) => {
const ids = String(query.ids || query.id || '')
.split(',')
.map((id) => id.trim())
.filter(Boolean)
return request(
`/api/resource/commentInfo/list`,
{
resourceType: resourceTypeIdMap[String(query.type || 0)],
resourceIds: JSON.stringify(ids),
},
createOption(query, 'weapi'),
)
}

View File

@ -1686,6 +1686,62 @@ tags: 歌单标签
**调用例子 :** `/comment/video?id=89ADDE33C0AAE8EC14B99F6750DB954D`
### 评论统计数据
说明 : 调用此接口 , 传入资源类型和资源 id 列表 , 可批量获取对应资源的评论统计数据 ( 不需要登录 )
**必选参数 :**
`type`: 数字 , 资源类型 , 对应以下类型
```
0: 歌曲
1: mv
2: 歌单
3: 专辑
4: 电台节目
5: 视频
6: 动态
7: 电台
```
`ids`: 资源 id 列表 , 多个 id 用逗号分隔 , 如 `186016,347230`
**接口地址 :** `/comment/info/list`
**调用例子 :** `/comment/info/list?type=0&ids=186016,347230`
**返回数据 :**
```json
{
"data": [
{
"latestLikedUsers": null,
"liked": false,
"comments": null,
"resourceType": 4,
"resourceId": 186016,
"commentUpgraded": false,
"musicianSaidCount": 0,
"commentCountDesc": "100w+",
"likedCount": 347,
"commentCount": 1970844,
"shareCount": 109721,
"threadId": "R_SO_4_186016"
}
],
"code": 200
}
```
### 热门评论
说明 : 调用此接口 , 传入 type, 资源 id 可获得对应资源热门评论 ( 不需要登录 )
@ -2783,12 +2839,14 @@ type : 地区
**1. 后端代理模式 (默认)**
文件通过服务器转发到云存储,调用简单,但受服务器限制:
- Vercel Serverless Functions 限制请求体大小为 4.5MB
- 自建服务器需配置足够大的请求体限制
**2. 客户端直传模式 (推荐用于 Vercel)**
文件直接从客户端上传到云存储服务器,绕过服务器限制:
- 支持大文件上传
- 适合 Vercel、Netlify 等有请求体限制的平台
- 需要前端配合实现
@ -2800,12 +2858,14 @@ type : 地区
**接口地址 :** `/cloud/upload/token`
**必选参数 :**
- `cookie`: 网易云音乐 Cookie (在请求体中传递)
- `md5`: 文件 MD5 值
- `fileSize`: 文件大小(字节)
- `filename`: 文件名
**返回数据 :**
```json
{
"code": 200,
@ -2824,6 +2884,7 @@ type : 地区
**接口地址 :** `/cloud/upload/complete`
**必选参数 :**
- `cookie`: 网易云音乐 Cookie (在请求体中传递)
- `songId`: 歌曲 ID
- `resourceId`: 资源 ID
@ -2831,6 +2892,7 @@ type : 地区
- `filename`: 文件名
**可选参数 :**
- `song`: 歌曲名
- `artist`: 艺术家
- `album`: 专辑名
@ -2858,6 +2920,7 @@ type : 地区
**调用例子 :** `/cloud/match?uid=32953014&sid=aaa&asid=bbb` `/cloud/match?uid=32953014&sid=bbb&asid=0`
### 获取云盘歌词
说明: 调用此接口, 获取云盘歌曲的歌词,歌词来自此文件的音乐元数据`LYRICS`标签。
**可选参数 :**
@ -4951,7 +5014,6 @@ let data = encodeURIComponent(
**调用例子:** `/vip/sign/info`
### 用户的创建歌单列表
说明 : 调用此接口, 传入用户id, 获取用户的创建歌单列表