From c37e763b2e753390e0f81dcaa439be7c4ce788a3 Mon Sep 17 00:00:00 2001 From: binaryify Date: Fri, 4 May 2018 17:43:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=83=AD=E6=90=9C=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=20#233?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.js | 3 +++ docs/README.md | 11 +++++++++++ package.json | 2 +- router/search_hot.js | 24 ++++++++++++++++++++++++ 4 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 router/search_hot.js diff --git a/app.js b/app.js index 2b3d260..c55bb73 100644 --- a/app.js +++ b/app.js @@ -176,6 +176,9 @@ app.use("/resource/like", require("./router/resource_like")); // 搜索 app.use("/search", require("./router/search")); +// 热搜 +app.use("/search/hot", require("./router/search_hot.js")); + //搜索 multimatch app.use("/search/multimatch", require("./router/search_multimatch")); diff --git a/docs/README.md b/docs/README.md index 12862fc..b1fc129 100644 --- a/docs/README.md +++ b/docs/README.md @@ -16,6 +16,9 @@ ## 版本新特性 +### 2.9.3 | 2018.05.04 +增加热搜接口 + ### 2.9.0 | 2018.01.26 docker 构建文件的一些增强以及增加访问日志和调试输出 @@ -117,6 +120,7 @@ banner 接口 , 增加刷新登录接口 , 增加电台相关接口 , 补充评 60. 电台 - 节目 61. 给评论点赞 62. 获取动态 +63. 获取热搜 ## 安装 @@ -422,6 +426,13 @@ mp3url 不能直接用 , 可通过 `/music/url` 接口传入歌曲 id 获取具 返回数据如下图 : ![搜索音乐](https://raw.githubusercontent.com/Binaryify/NeteaseCloudMusicApi/master/static/%E6%90%9C%E7%B4%A2.png) +### 热搜 +说明 : 调用此接口,可获取热门搜索列表 + +**接口地址 :** `/search/hot` + +**调用例子 :** `/search/hot` + ### 搜索建议 说明 : 调用此接口 , 传入搜索关键词可获得搜索建议 , 搜索结果同时包含单曲 , 歌手 , diff --git a/package.json b/package.json index 037b3f9..0c26869 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "NeteaseCloudMusicApi", - "version": "2.9.2", + "version": "2.9.3", "description": "网易云音乐 NodeJS 版 API", "scripts": { "start": "node app.js", diff --git a/router/search_hot.js b/router/search_hot.js new file mode 100644 index 0000000..36818f6 --- /dev/null +++ b/router/search_hot.js @@ -0,0 +1,24 @@ +const express = require("express"); +const router = express(); +const { createWebAPIRequest } = require("../util/util"); + +router.get("/", (req, res) => { + const cookie = req.get("Cookie") ? req.get("Cookie") : ""; + const data = { + type: 1111 + }; + const id = req.query.id; + createWebAPIRequest( + "music.163.com", + "/weapi/search/hot", + "POST", + data, + cookie, + music_req => { + res.send(music_req); + }, + err => res.status(502).send("fetch error") + ); +}); + +module.exports = router; -- GitLab