From 4a65fdea9578d15e620973237da760fee31c88b3 Mon Sep 17 00:00:00 2001 From: binaryify Date: Wed, 12 Dec 2018 14:31:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=94=B5=E5=8F=B0=E8=8A=82?= =?UTF-8?q?=E7=9B=AE=E6=8E=A5=E5=8F=A3,=E6=9B=B4=E6=96=B0=E6=96=87?= =?UTF-8?q?=E6=A1=A3=20#386=20#394?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.MD | 5 +++++ docs/README.md | 16 ++-------------- module/dj_program.js | 27 +++++++++++++++------------ module/top_song.js | 22 ++++++++++++---------- package.json | 2 +- 5 files changed, 35 insertions(+), 37 deletions(-) diff --git a/CHANGELOG.MD b/CHANGELOG.MD index 09d5a63..87f417e 100644 --- a/CHANGELOG.MD +++ b/CHANGELOG.MD @@ -1,4 +1,9 @@ # 更新日志 +### 3.0.8 | 2018.12.12 +- 更新文档 #386 #394 + +- 优化电台节目接口 + ### 3.0.7 | 2018.11.21 - 修复歌单详情列表,排行榜,所有榜单失效的问题,更新文档 #380 #381 diff --git a/docs/README.md b/docs/README.md index 6dd5fe2..e07b9ac 100644 --- a/docs/README.md +++ b/docs/README.md @@ -706,16 +706,6 @@ mp3url 不能直接用 , 可通过 `/song/url` 接口传入歌曲 id 获取具 **必选参数 :** `keywords` : 关键词 -**可选参数 :** - -`limit` : 返回数量 , 默认为 30 - -`offset` : 偏移数量,用于分页 , 如 -: 如 :( 页数 -1)\*30, 其中 30 为 limit 的值 , 默认为 0 - -`type`: 搜索类型;默认为 1 即单曲 , 取值意义 : 1: 单曲 10: 专辑 100: 歌手 1000: -歌单 1002: 用户 1004: MV 1006: 歌词 1009: 电台 - **接口地址 :** `/search/suggest` **调用例子 :** `/search/suggest?keywords= 海阔天空` @@ -807,10 +797,6 @@ mp3url 不能直接用 , 可通过 `/song/url` 接口传入歌曲 id 获取具 韩国:16 ``` -`limit`: 取出数量 , 默认为 100 - -`offset`: 偏移数量 , 用于分页 , 如 :( 评论页数 -1)\*100, 其中 100 为 limit 的值 - **接口地址 :** `/top/song` **调用例子 :** `/top/song?type=96` @@ -1632,6 +1618,8 @@ type='1009' 获取其 id, 如`/search?keywords= 代码时间 &type=1009` `offset` : 偏移数量,用于分页 , 如 : 如 :( 页数 -1)\*30, 其中 30 为 limit 的值 , 默认为 0 +`asc` : 排序方式,默认为 `false` (新 => 老 ) 设置 `true` 可改为 老 => 新 + **接口地址 :** `/dj/program` **调用例子 :** `/dj/program?rid=336355127&limit=40` ( 对应 ' 代码时间 ' 的节目列表 ) diff --git a/module/dj_program.js b/module/dj_program.js index 31380a4..ab8bb57 100644 --- a/module/dj_program.js +++ b/module/dj_program.js @@ -1,14 +1,17 @@ // 电台节目列表 - +const { toBoolean } = require('../util') module.exports = (query, request) => { - const data = { - radioId: query.rid, - limit: query.limit || 30, - offset: query.offset || 0, - asc: query.asc - } - return request( - 'POST', `https://music.163.com/weapi/dj/program/byradio`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} - ) -} \ No newline at end of file + const data = { + radioId: query.rid, + limit: query.limit || 30, + offset: query.offset || 0, + asc: toBoolean(query.asc) + } + console.log(toBoolean(query.asc)) + return request( + 'POST', + `https://music.163.com/weapi/dj/program/byradio`, + data, + { crypto: 'weapi', cookie: query.cookie, proxy: query.proxy } + ) +} diff --git a/module/top_song.js b/module/top_song.js index 2a9b7fc..f2524df 100644 --- a/module/top_song.js +++ b/module/top_song.js @@ -1,14 +1,16 @@ // 新歌速递 module.exports = (query, request) => { - const data = { - areaId: query.type || 0, // 全部:0 华语:7 欧美:96 日本:8 韩国:16 - limit: query.limit || 100, - offset: query.offset || 0, - total: true - } - return request( - 'POST', `https://music.163.com/weapi/v1/discovery/new/songs`, data, - {crypto: 'weapi', cookie: query.cookie, proxy: query.proxy} - ) + const data = { + areaId: query.type || 0, // 全部:0 华语:7 欧美:96 日本:8 韩国:16 + // limit: query.limit || 100, + // offset: query.offset || 0, + total: true + } + return request( + 'POST', + `https://music.163.com/weapi/v1/discovery/new/songs`, + data, + { crypto: 'weapi', cookie: query.cookie, proxy: query.proxy } + ) } diff --git a/package.json b/package.json index 48554d9..76e6fad 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "NeteaseCloudMusicApi", - "version": "3.0.7", + "version": "3.0.8", "description": "网易云音乐 NodeJS 版 API", "scripts": { "start": "node app.js", -- GitLab