diff --git a/CHANGELOG.MD b/CHANGELOG.MD index bb3cdb9f361..74920cbd66b 100644 --- a/CHANGELOG.MD +++ b/CHANGELOG.MD @@ -1,4 +1,7 @@ # 更新日志 +### 2.5.0 | 2017.4.29 +增加 mv/专辑/歌单评论接口,增加云盘相关接口,增加获取用户动态/信息接口,增加关注/粉丝列表接口,增加收藏歌单接口,增加相似 mv/歌曲/用户接口,增加 banner 接口,增加刷新登录接口,增加电台相关接口,补充评论接口,更新文档 + ### 2.4.6 | 2017.4.21 增加播放 mv 接口,更新文档 diff --git a/README.MD b/README.MD index 42a1841b861..62ca6169d0e 100644 --- a/README.MD +++ b/README.MD @@ -14,6 +14,9 @@ [darknessomi/musicbox](https://github.com/darknessomi/musicbox) ## 版本新特性 +### 2.5.0 | 2017.4.29 +增加 mv/专辑/歌单评论接口,增加云盘相关接口,增加获取用户动态/信息接口,增加关注/粉丝列表接口,增加收藏歌单接口,增加相似 mv/歌曲/用户接口,增加 banner 接口,增加刷新登录接口,增加电台相关接口,补充评论接口,更新文档 + ### 2.4.6 | 2017.4.21 增加播放 mv 接口,更新文档 diff --git a/app.js b/app.js index 2237f978347..e11e15fc1d5 100644 --- a/app.js +++ b/app.js @@ -2,89 +2,250 @@ const express = require('express') const http = require('http') const app = express() +// 跨域设置 +app.all('*', function (req, res, next) { + res.header("Access-Control-Allow-Credentials", true) + res.header("Access-Control-Allow-Origin", "http://localhost:8080") + res.header("Access-Control-Allow-Headers", "X-Requested-With") + res.header("Access-Control-Allow-Methods", "PUT,POST,GET,DELETE,OPTIONS") + res.header("X-Powered-By", ' 3.2.1') + res.header("Content-Type", "application/json;charset=utf-8") + next() +}) + + + +// 获取专辑内容 +app.use('/album', require('./router/album')) + +// 获取歌手单曲 +app.use('/artists', require('./router/artists')) + +// 获取歌手专辑列表 +app.use('/artist/album', require('./router/artist_album')) + +//艺术家-信息 +app.use("/artist/desc", require("./router/artists_desc")) + +//艺术家-mv +app.use("/artist/mv", require("./router/artists_mv")) + + + +// 获取 banner +app.use('/banner', require('./router/banner')) + +app.use('/check/music', require('./router/check_music')) + + +app.use('/comment/music', require('./router/comment_music')) + +app.use('/comment/mv', require('./router/comment_mv')) + + +app.use('/comment/album', require('./router/comment_album')) + +app.use('/comment/playlist', require('./router/comment_playlist')) + +//未知 api +app.use('/comment/like', require('./router/comment_like')) + +app.use('/comment/dj', require('./router/comment_dj')) + +//签到 +app.use("/daily_signin", require("./router/daily_signin")) + +//djradio detail +app.use("/dj/detail", require("./router/dj_detail")) + +//dj主播 radio +app.use("/dj/program", require("./router/dj_program")) + +app.use("/dj/program/detail", require("./router/dj_program_detail")) + +app.use("/dj/sub", require("./router/dj_sub")) + + +app.use("/dj/catelist", require("./router/dj_catelist")) + +app.use("/dj/hot", require("./router/dj_hot")) + +// 精选电台 +app.use("/dj/recommend", require("./router/dj_recommend")) + +//精选电台-分类电台 +app.use("/dj/recommend/type", require("./router/dj_recommend_type")) + + + +//垃圾桶 +app.use("/fm_trash", require("./router/fm_trash")) + +app.use("/follow", require("./router/follow")) + +// 喜欢歌曲 +app.use("/like", require("./router/like")) + +app.use("/likelist", require("./router/likelist")) + //手机登录 app.use('/login/cellphone', require('./router/loginCellphone')) //邮箱登录 app.use('/login', require('./router/login')) -//获取评论 -app.use('/comment', require('./router/comment')) - -// 获取每日推荐歌曲 -app.use('/recommend/songs', require('./router/recommendSongs')) +//登录刷新 +app.use('/login/refresh', require('./router/login_refresh')) -// 获取每日推荐歌单 -app.use('/recommend/resource', require('./router/recommendResource')) +// 不明 api +app.use('/log/web', require('./router/logWeb')) // 获取歌词 app.use('/lyric', require('./router/lyric')) -// 获取专辑内容 -app.use('/album', require('./router/album')) +// 获取音乐 url +app.use('/music/url', require('./router/musicUrl')) -// 获取歌手单曲 -app.use('/artists', require('./router/artists')) +//最新 mv +app.use("/mv/first", require("./router/mv_first")) -// 获取歌手专辑列表 -app.use('/artist_album', require('./router/artist_album')) +//播放 mv +app.use("/mv/url", require("./router/mv_url")) -// 歌单(网友精选碟) hot||new http://music.163.com/#/discover/playlist/ -app.use('/top_playlist', require('./router/top_playlist')) +//mv +app.use("/mv", require("./router/mv")) -// 新碟上架 http://music.163.com/#/discover/album/ -app.use('/new_albums', require('./router/new_albums')) +// 私人 FM +app.use("/personal_fm", require("./router/personal_fm")) + +//推荐歌单 +app.use("/personalized", require("./router/personalized")) + +//推荐dj +app.use("/personalized/djprogram", require("./router/personalized_djprogram")) + +//推荐新音乐 +app.use("/personalized/newsong", require("./router/personalized_newsong")) + +//独家放送 +app.use("/personalized/privatecontent", require("./router/personalized_privatecontent")) + +//推荐mv +app.use("/personalized/mv", require("./router/personalized_mv")) -// 热门歌手 http://music.163.com/#/discover/artist/ -app.use('/top_artists', require('./router/top_artists')) -// 获取用户歌单 -app.use('/user/playlist', require('./router/userPlaylist')) // 获取歌单内列表 -app.use('/playlist/detail', require('./router/playlistDetail')) +app.use('/playlist/detail', require('./router/playlist_detail')) -//不明 api -app.use('/playlist/tracks', require('./router/playlistTracks')) +//收藏单曲到歌单,从歌单删除歌曲 op=del,add;pid=歌单id,tracks=歌曲id +app.use('/playlist/tracks', require('./router/playlist_tracks')) -// 获取音乐 url -app.use('/music/url', require('./router/musicUrl')) +app.use('/playlist/hot', require('./router/playlist_hot')) + + +app.use('/playlist/catlist', require('./router/playlist_catlist')) + +//推荐节目 +app.use("/program/recommend", require("./router/program_recommend")) + + + +// 获取每日推荐歌曲 +app.use('/recommend/songs', require('./router/recommend_songs')) + +// 获取每日推荐歌单 +app.use('/recommend/resource', require('./router/recommend_resource')) + +//取消推荐 +app.use('/recommend/dislike', require('./router/recommend_dislike')) + + +app.use('/resource/like', require('./router/resource_like')) // 搜索 app.use('/search', require('./router/search')) +// 搜索 hot +app.use('/search/hot', require('./router/search_hot')) + +//搜索 multimatch +app.use('/search/multimatch', require('./router/search_multimatch')) + +// 搜索 suggest,搜索结果包含单曲,歌手,歌单,mv信息 +app.use('/search/suggest', require('./router/search_suggest')) + +//simi ,相似歌单 +app.use("/simi/playlist", require("./router/simi_playlist")) + +//simi ,相似歌曲 +app.use("/simi/song", require("./router/simi_song")) + +//相似 mv +app.use("/simi/mv", require("./router/simi_mv")) + +//simi ,相似关注的用户 +app.use("/simi/user", require("./router/simi_user")) + +//相似歌手 +app.use("/simi/artist", require("./router/simi_artists")) + // 获取音乐详情 -app.use('/music/songDetail', require('./router/songDetail')) +app.use('/song/detail', require('./router/song_detail')) -// 不明 api -app.use('/log/web', require('./router/logWeb')) -// 私人 FM -app.use("/personal_fm",require("./router/personal_fm")) -// 喜欢歌曲 -app.use("/like",require("./router/like")) +// 新碟上架 http://music.163.com/#/discover/album/ +app.use('/top/album', require('./router/top_album')) -//签到 -app.use("/daily_signin",require("./router/daily_signin")) +// 热门歌手 http://music.163.com/#/discover/artist/ +app.use('/top/artists', require('./router/top_artists')) -//垃圾桶 -app.use("/fm_trash",require("./router/fm_trash")) +app.use('/top/list', require('./router/top_list')) -//排行榜 -app.use("/top_list",require("./router/top_list")) +app.use('/top/mv', require('./router/top_mv')) -//mv -app.use("/mv",require("./router/mv")) +//分类歌单 +app.use("/top/playlist", require("./router/top_playlist")) -//play_mv -app.use("/play_mv",require("./router/play_mv")) +//精品歌单 +app.use("/top/playlist/highquality", require("./router/top_playlist_highquality")) -process.on('SIGHUP', () => { - console.log('server: bye bye') - process.exit() -}) +app.use('/top/song', require('./router/top_songs')) + + + +app.use('/toplist', require('./router/toplist')) + +app.use('/toplist/artist', require('./router/toplist_artist')) + +app.use('/toplist/detail', require('./router/toplist_detail')) + +// 获取用户歌单 +app.use('/user/playlist', require('./router/user_playlist')) + +// 获取用户电台 +app.use('/user/audio', require('./router/user_audio')) + +//云盘数据 +app.use("/user/cloud", require("./router/user_cloud")) + +//云盘数据详情???不要使用 +app.use("/user/cloud/search", require("./router/user_cloud_search")) +//用户动态 +app.use("/user/event", require("./router/user_event")) +// 获取用户歌单 +app.use('/user/detail', require('./router/user_detail')) + +app.use('/user/dj', require('./router/user_dj')) + +app.use('/user/followeds', require('./router/user_followeds')) + +app.use('/user/follows', require('./router/user_follows')) + +app.use('/user/subcount', require('./router/user_subcount')) +app.use("/user/record", require("./router/user_playrecord")) const port = process.env.PORT || 3000 app.listen(port, () => { diff --git a/docs/README.md b/docs/README.md index bd5d623ec4a..a139f6a28bc 100644 --- a/docs/README.md +++ b/docs/README.md @@ -7,37 +7,74 @@ [darknessomi/musicbox](https://github.com/darknessomi/musicbox) +[sqaiyan/netmusic-node](https://github.com/sqaiyan/netmusic-node) ## 工作原理 跨站请求伪造 (CSRF), 伪造请求头,调用官方 API ## 版本新特性 -### 2.4.6 | 2017.4.21 -增加播放 mv 接口,更新文档 +### 2.5.0 | 2017.4.29 +增加 mv/专辑/歌单评论接口,增加云盘相关接口,增加获取用户动态/信息接口,增加关注/粉丝列表接口,增加收藏歌单接口,增加相似 mv/歌曲/用户接口,增加 banner 接口,增加刷新登录接口,增加电台相关接口,补充评论接口,更新文档 ## 功能特性 1. 登录 -2. 获取用户歌单 -3. 获取歌曲详情 -4. 获取音乐 url -5. 搜索 -6. 获取歌词 -7. 获取评论 -8. 获取专辑内容 -9. 获取每日推荐歌单 -10. 获取每日推荐歌曲 -11. 喜欢歌曲 -12. 私人FM -13. 把私人 FM 的歌曲移动至垃圾桶 -14. 签到 -15. 各排行榜 -16. 歌曲详情 -17. 歌单(网友精选碟) -18. 新碟上架 -19. 热门歌手 -20. 获取 mv 信息 -21. 播放 mv -22. 获取歌手专辑 -23. 获取歌手单曲 +2. 刷新登录 +3. 获取用户信息,歌单,收藏,mv,dj数量 +4. 获取用户歌单 +5. 获取用户电台 +6. 获取用户关注列表 +7. 获取用户粉丝列表 +8. 获取用户动态 +9. 获取用户播放记录 +10. 获取精品歌单 +11. 获取歌单详情 +13. 搜索 +14. 搜索建议 +15. 获取歌词 +16. 歌曲评论 +17. 收藏单曲到歌单 +18. 专辑评论 +19. 歌单评论 +20. mv 评论 +21. 电台节目评论 +22. banner +23. 获取歌曲详情 +24. 获取专辑内容 +25. 获取歌手单曲 +26. 获取歌手 mv +27. 获取歌手专辑 +28. 获取歌手描述 +29. 获取相似歌手 +30. 获取相似歌单 +31. 相似 mv +32. 获取相似音乐 +33. 获取相似用户 +34. 获取每日推荐歌单 +35. 获取每日推荐歌曲 +36. 私人 FM +37. 签到 +38. 喜欢音乐 +39. 垃圾桶 +40. 歌单(网友精选碟) +41. 新碟上架 +42. 热门歌手 +43. 最新 mv +44. 推荐 mv +45. 推荐歌单 +46. 推荐新音乐 +47. 推荐电台 +48. 推荐节目 +49. 独家放送 +50. mv 排行 +51. 获取 mv 数据 +52. 播放 mv +53. 排行榜 +54. 云盘 +55. 电台-推荐 +56. 电台-分类 +57. 电台-分类推荐 +58. 电台-订阅 +59. 电台-详情 +60. 电台-节目 ## 安装 ``` shell @@ -100,8 +137,27 @@ $ set PORT=4000 && node app.js #### 注意 调用登录接口的速度比调用其他接口慢,因为登录过程调用了加密算法 +### 刷新登录 +说明:调用此接口,可刷新登录状态 + +**调用例子:** +`/login/refresh` + +### 获取用户信息,歌单,收藏,mv,dj数量 +说明:登陆后调用此接口,传入用户 id, 可以获取用户信息 + +**必选参数:** +`uid` : 用户 id + +**接口地址:** +`/user/subcount` + +**调用例子:** +`/user/subcount` + + ### 获取用户歌单 -说明:登陆后调用此接口,传入用户 id, 可以获取用户歌单 +说明:登陆后调用此接口,传入用户 id, 可以获取用户歌单 **必选参数:** `uid` : 用户 id @@ -115,6 +171,92 @@ $ set PORT=4000 && node app.js 返回数据如下图: ![用户歌单](https://raw.githubusercontent.com/Binaryify/NeteaseCloudMusicApi/master/static/%E7%94%A8%E6%88%B7%E6%AD%8C%E5%8D%95.png) +### 获取用户电台 +说明:登陆后调用此接口,传入用户 id, 可以获取用户电台 + +**必选参数:** +`uid` : 用户 id + +**接口地址:** +`/user/dj` + +**调用例子:** +`/user/dj?uid=32953014` + +### 获取用户关注列表 +说明:登陆后调用此接口,传入用户 id, 可以获取用户关注列表 + +**必选参数:** +`uid` : 用户 id + +**可选参数:** +`limit` : 返回数量,默认为30 +`offset` : 偏移数量,用于分页,如: 如:(页数-1)*30, 其中 30 为 limit 的值,默认为0 + +**接口地址:** +`/user/follows` + +**调用例子:** +`/user/follows?uid=32953014` + +### 获取用户粉丝列表 +说明:登陆后调用此接口,传入用户 id, 可以获取用户粉丝列表 + +**必选参数:** +`uid` : 用户 id + +**可选参数:** +`limit` : 返回数量,默认为30 +`offset` : 偏移数量,用于分页,如: 如:(页数-1)*30, 其中 30 为 limit 的值,默认为0 + +**接口地址:** +`/user/followeds` + +**调用例子:** +`/user/followeds?uid=32953014` + +### 获取用户动态 +说明:登陆后调用此接口,传入用户 id, 可以获取用户动态 + +**必选参数:** +`uid` : 用户 id + +**接口地址:** +`/user/event` + +**调用例子:** +`/user/event?uid=32953014` + +### 获取用户播放记录 +说明:登陆后调用此接口,传入用户 id,可获取用户播放记录 + +**必选参数:** +`uid` : 用户 id + +**可选参数:** +`type` : type=1时只返回weekData, type=0时返回allData + +**接口地址:** +`/user/record` + +**调用例子:** +`/user/record?uid=32953014&type=1` + +### 获取精品歌单 +说明:调用此接口,可获取精品歌单 + +**可选参数:** +`limit`: 取出评论数量,默认为20 + +`offset`: 偏移数量,用于分页,如:(评论页数-1)*20, 其中 20 为 limit 的值 + +**接口地址:** +`//top/playlist/highquality` + +**调用例子:** +`/playlist/detail?id=24381616` + + ### 获取歌单详情 说明:歌单能看到歌单名字,但看不到具体歌单内容,调用此接口,传入歌单 id,可以获取对应歌单内的所有的音乐 @@ -151,9 +293,11 @@ $ set PORT=4000 && node app.js **必选参数:** `keywords` : 关键词 -**可选参数:** +**可选参数:** `limit` : 返回数量,默认为30 -`type`: 搜索类型;默认为1,取值意义: +`offset` : 偏移数量,用于分页,如: 如:(页数-1)*30, 其中 30 为 limit 的值,默认为0 + +`type`: 搜索类型;默认为1即单曲,取值意义: 1: 单曲 10: 专辑 100: 歌手 @@ -163,7 +307,7 @@ $ set PORT=4000 && node app.js 1006: 歌词 1009: 电台 -`offset` : 偏移数量,用于分页,如: 如:(评论页数-1)*30, 其中 30 为 limit 的值,默认为0 + **接口地址:** `/search` @@ -174,6 +318,35 @@ $ set PORT=4000 && node app.js 返回数据如下图: ![搜索音乐](https://raw.githubusercontent.com/Binaryify/NeteaseCloudMusicApi/master/static/%E6%90%9C%E7%B4%A2.png) +### 搜索建议 +说明:调用此接口,传入搜索关键词可获得搜索建议,搜索结果同时包含单曲,歌手,歌单,mv信息 + +**必选参数:** +`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=海阔天空` + + ### 获取歌词 说明:调用此接口,传入音乐 id 可获得对应音乐的歌词(不需要登录) @@ -189,8 +362,8 @@ $ set PORT=4000 && node app.js 返回数据如下图: ![获取歌词](https://raw.githubusercontent.com/Binaryify/NeteaseCloudMusicApi/master/static/%E6%AD%8C%E8%AF%8D.png) -### 获取评论 -说明:调用此接口,传入歌音乐 id和 limit 参数, 可获得该音乐的所有评论(不需要登录) +### 歌曲评论 +说明:调用此接口,传入音乐 id和 limit 参数, 可获得该音乐的所有评论(不需要登录) **必选参数:** `id`: 音乐 id @@ -201,14 +374,105 @@ $ set PORT=4000 && node app.js `offset`: 偏移数量,用于分页,如:(评论页数-1)*20, 其中 20 为 limit 的值 **接口地址:** -`/comment` +`/comment/music` **调用例子:** -`/comment?id=186016&limit=1` +`/comment/music?id=186016&limit=1` 返回数据如下图: ![获取评论](https://raw.githubusercontent.com/Binaryify/NeteaseCloudMusicApi/master/static/comment.png) +### 收藏单曲到歌单 +说明:调用此接口,传入音乐 id和 limit 参数, 可获得该专辑的所有评论(需要登录) + +**必选参数:** +`op`: 从歌单增加单曲为add,删除为 del +`pid`: 歌单id +`tracks`: 歌曲id + +**接口地址:** +`/playlist/tracks` + +**调用例子:** +`/playlist/tracks?op=add&pid=24381616&tracks=347230` (对应把'海阔天空'添加到'我'的歌单,测试的时候请把这里的 pid换成你自己的) + +### 专辑评论 +说明:调用此接口,传入音乐 id和 limit 参数, 可获得该专辑的所有评论(不需要登录) + +**必选参数:** +`id`: 专辑 id + +**可选参数:** +`limit`: 取出评论数量,默认为20 + +`offset`: 偏移数量,用于分页,如:(评论页数-1)*20, 其中 20 为 limit 的值 + +**接口地址:** +`/comment/album` + +**调用例子:** +`/comment/album?id=32311` + +### 歌单评论 +说明:调用此接口,传入音乐 id和 limit 参数, 可获得该歌单的所有评论(不需要登录) + +**必选参数:** +`id`: 歌单 id + +**可选参数:** +`limit`: 取出评论数量,默认为20 + +`offset`: 偏移数量,用于分页,如:(评论页数-1)*20, 其中 20 为 limit 的值 + +**接口地址:** +`/comment/playlist` + +**调用例子:** +`/comment/playlist?id=705123491` + +### mv 评论 +说明:调用此接口,传入音乐 id和 limit 参数, 可获得该 mv 的所有评论(不需要登录) + +**必选参数:** +`id`: mv id + +**可选参数:** +`limit`: 取出评论数量,默认为20 + +`offset`: 偏移数量,用于分页,如:(评论页数-1)*20, 其中 20 为 limit 的值 + +**接口地址:** +`/comment/mv` + +**调用例子:** +`/comment/mv?id=5436712` + +### 电台节目评论 +说明:调用此接口,传入音乐 id和 limit 参数, 可获得该 电台节目 的所有评论(不需要登录) + +**必选参数:** +`id`: 电台节目的 id + +**可选参数:** +`limit`: 取出评论数量,默认为20 + +`offset`: 偏移数量,用于分页,如:(评论页数-1)*20, 其中 20 为 limit 的值 + +**接口地址:** +`/comment/dj` + +**调用例子:** +`/comment/dj?id=794062371` + +### banner +说明:调用此接口,可获取 banner(轮播图)数据 +注:因参数未知,只能获取比较旧的数据,如果有知道参数的小伙伴,可提交 PR + +**接口地址:** +`/banner` + +**调用例子:** +`/banner` ### 获取歌曲详情 说明:调用此接口,传入音乐 id, 可获得歌曲详情 @@ -230,7 +494,7 @@ $ set PORT=4000 && node app.js 说明:调用此接口,传入专辑 id,可获得专辑内容 **必选参数:** -`id`: id +`id`: 专辑 id **接口地址:** `/album` @@ -256,21 +520,112 @@ $ set PORT=4000 && node app.js 返回数据如下图: ![获取歌手单曲](https://raw.githubusercontent.com/Binaryify/NeteaseCloudMusicApi/master/static/artists.png) +### 获取歌手 mv +说明:调用此接口,传入歌手 id,可获得歌手 mv 信息,具体 mv 播放地址可调用`/mv`传入此接口获得的mvid 来拿到,如: +`/artist/mv?id=6452`,`/mv?mvid=5461064` + +**必选参数:** +`id`: 歌手 id,可由搜索接口获得 + +**接口地址:** +`/artist/mv` + +**调用例子:** +`/artist/mv?id=6452` + ### 获取歌手专辑 说明:调用此接口,传入歌手 id,可获得歌手专辑内容 **必选参数:** `id`: 歌手 id +**可选参数:** +`limit`: 取出数量,默认为50 + +`offset`: 偏移数量,用于分页,如:(页数-1)*50, 其中 50 为 limit 的值,默认为0 **接口地址:** -`/artist_album` +`/artist/album` **调用例子:** -`/artist_album?id=6452&limit=30` +`/artist/album?id=6452&limit=30` (周杰伦) 返回数据如下图: ![获取专辑内容](https://raw.githubusercontent.com/Binaryify/NeteaseCloudMusicApi/master/static/artist_album.png) +### 获取歌手描述 +说明:调用此接口,传入歌手 id,可获得歌手描述 + +**必选参数:** +`id`: 歌手 id + +**接口地址:** +`/artist/desc` + +**调用例子:** +`/artist/desc?id=6452` (周杰伦) + +### 获取相似歌手 +说明:调用此接口,传入歌手 id,可获得相似歌手 + +**必选参数:** +`id`: 歌手 id + +**接口地址:** +`/simi/artist` + +**调用例子:** +`/simi/artist?id=6452` (对应和周杰伦相似歌手) + +### 获取相似歌单 +说明:调用此接口,传入歌曲 id,可获得相似歌单 + +**必选参数:** +`id`: 歌曲 id + +**接口地址:** +`/simi/playlist` + +**调用例子:** +`/simi/playlist?id=347230` (对应'光辉岁月'相似歌单) + + +### 相似 mv +说明:调用此接口,传入 `mvid` 可获取相似 mv +**必选参数:** +`mvid`: mv id + +**接口地址:** +`/simi/mv` + +**调用例子:** +`/simi/mv?mvid=5436712` + + +### 获取相似音乐 +说明:调用此接口,传入歌曲 id,可获得相似歌曲 + +**必选参数:** +`id`: 歌曲 id + +**接口地址:** +`/simi/song` + +**调用例子:** +`/simi/song?id=347230` (对应'光辉岁月'相似歌曲) + +### 获取相似用户 +说明:调用此接口,传入歌曲 id,可获得相似歌曲 + +**必选参数:** +`id`: 歌曲 id + +**接口地址:** +`/simi/user` + +**调用例子:** +`/simi/user?id=347230` (对应'光辉岁月'相似歌曲) + + ### 获取每日推荐歌单 说明:调用此接口,可获得每日推荐歌单(需要登录) @@ -372,10 +727,6 @@ $ set PORT=4000 && node app.js 说明:调用此接口,可获取网友精选碟歌单 **可选参数:** -`limit`: 取出数量,默认为50 - -`offset`: 偏移数量,用于分页,如:(评论页数-1)*20, 其中 20 为 limit 的值,默认为0 - `order`: 可选值为 'new' 和 'hot',分别对应最新和最热,默认为 'hot' **接口地址:** @@ -394,7 +745,7 @@ $ set PORT=4000 && node app.js **可选参数:** `limit`: 取出数量,默认为50 -`offset`: 偏移数量,用于分页,如:(评论页数-1)*50, 其中 50 为 limit 的值,默认为0 +`offset`: 偏移数量,用于分页,如:(页数-1)*50, 其中 50 为 limit 的值,默认为0 **接口地址:** `/new_albums` @@ -412,7 +763,7 @@ $ set PORT=4000 && node app.js **可选参数:** `limit`: 取出数量,默认为50 -`offset`: 偏移数量,用于分页,如:(评论页数-1)*50, 其中 50 为 limit 的值,默认为0 +`offset`: 偏移数量,用于分页,如:(页数-1)*50, 其中 50 为 limit 的值,默认为0 **接口地址:** `/top_artists` @@ -424,10 +775,93 @@ $ set PORT=4000 && node app.js ![热门歌手](https://raw.githubusercontent.com/Binaryify/NeteaseCloudMusicApi/master/static/top_artists.png) -### mv -说明:调用此接口,传入 mvid(在搜索音乐的时候传 type=1004获得) ,可获取对应 MV 数据,数据包含 mv 名字,歌手,发布时间, mv 视频地址等数据,其中 mv 视频网易做了防盗链处理,不能直接播放,需要播放的话需要调用'播放 mv' 接口 +### 最新 mv +说明:调用此接口,可获取最新 mv + +**可选参数:** +`limit`: 取出数量,默认为 30 + +`offset`: 偏移数量,用于分页,如:(页数-1)*30, 其中 30 为 limit 的值,默认为0 + +**接口地址:** +`/mv/first` + +**调用例子:** +`/mv/first?limit=10` + +### 推荐 mv +说明:调用此接口,可获取推荐 mv + +**接口地址:** +`/personalized/mv` + +**调用例子:** +`/personalized/mv` + +### 推荐歌单 +说明:调用此接口,可获取推荐歌单 + +**接口地址:** +`/personalized` + +**调用例子:** +`/personalized` + +### 推荐新音乐 +说明:调用此接口,可获取推荐新音乐 + +**接口地址:** +`/personalized/newsong` + +**调用例子:** +`/personalized/newsong` + +### 推荐电台 +说明:调用此接口,可获取推荐电台 + +**接口地址:** +`/personalized/djprogram` + +**调用例子:** +`/personalized/djprogram` + +### 推荐节目 +说明:调用此接口,可获取推荐电台 + +**接口地址:** +`/program/recommend` + +**调用例子:** +`/program/recommend` + +### 独家放送 +说明:调用此接口,可获取独家放送 + +**接口地址:** +`/personalized/privatecontent` + +**调用例子:** +`/personalized/privatecontent` + + +### mv 排行 +说明:调用此接口,可获取 mv 排行 **可选参数:** +`limit`: 取出数量,默认为 30 + +`offset`: 偏移数量,用于分页,如:(页数-1)*30, 其中 30 为 limit 的值,默认为0 + +**接口地址:** +`top/mv` + +**调用例子:** +`top/mv?limit=10` + +### 获取 mv 数据 +说明:调用此接口,传入 mvid (在搜索音乐的时候传 type=1004获得) ,可获取对应 MV 数据,数据包含 mv 名字,歌手,发布时间, mv 视频地址等数据,其中 mv 视频网易做了防盗链处理,不能直接播放,需要播放的话需要调用'播放 mv' 接口 + +**必选参数:** `mvid`: mv 的 id **接口地址:** @@ -445,13 +879,13 @@ $ set PORT=4000 && node app.js 说明:调用此接口,传入 mv 地址,可播放 mv,也可将接口嵌入 video 标签使用,由于使用了 'pipe',进度条无法通过拖动进度条控制进度,如有解决方案可提出 PR 或者自行改造 **可选参数:** -`/url`: mv 的 地址 +`url`: mv 的 地址 **接口地址:** -`/play_mv` +`/mv/url` **调用例子:** -`/play_mv?url=http://v4.music.126.net/20170422034915/c98eab2f5e2c85fc8de2ab3f0f8ed1c6/web/cloudmusic/MjQ3NDQ3MjUw/89a6a279dc2acfcd068b45ce72b1f560/533e4183a709699d566180ed0cd9abe9.mp4` +`/mv/url?url=http://v4.music.126.net/20170422034915/c98eab2f5e2c85fc8de2ab3f0f8ed1c6/web/cloudmusic/MjQ3NDQ3MjUw/89a6a279dc2acfcd068b45ce72b1f560/533e4183a709699d566180ed0cd9abe9.mp4` 如下图: @@ -499,6 +933,85 @@ $ set PORT=4000 && node app.js ![排行榜](https://raw.githubusercontent.com/Binaryify/NeteaseCloudMusicApi/master/static/top_list.png) + +### 云盘 +说明:登陆后调用此接口,可获取云盘数据,获取的数据没有对应 url,需要再调用一次 `/music/url` 获取 url + +**接口地址:** +`/user/cloud` + +**调用例子:** +`/user/cloud` + +### 电台-推荐 +说明:登陆后调用此接口,可获得推荐电台 + +**接口地址:** +`/dj/recommend` + +**调用例子:** +`/dj/recommend` + +### 电台-分类 +说明:登陆后调用此接口,可获得电台类型 + +**接口地址:** +`/dj/catelist` + +**调用例子:** +`/dj/catelist` + +### 电台-分类推荐 +说明:登陆后调用此接口,可获得推荐电台 + +**必选参数:** +`type`: 电台类型,数字,可通过`/dj/catelist`获取,对应关系为 id 对应 此接口的 type, name 对应类型意义 + +**接口地址:** +`/dj/recommend/type` + +**调用例子:** +`/dj/recommend/type?type=1` + +### 电台-订阅 +说明:登陆后调用此接口,传入`rid`,可订阅 dj,dj 的 `rid` 可通过搜索指定 type='1009'获取其 id,如`/search?keywords=代码时间&type=1009` + +**必选参数:** +`rid`: 电台 的 id + +**接口地址:** +`/dj/sub` + +**调用例子:** +`/dj/sub?rid=336355127&t=1` (对应关注'代码时间') +`/dj/sub?rid=336355127&t=0` (对应取消关注'代码时间') + +### 电台-详情 +说明:登陆后调用此接口,传入`rid`,可获得对应电台的详情介绍 + +**必选参数:** +`rid`: 电台 的 id + +**接口地址:** +`/dj/detail?rid=336355127` + +**调用例子:** +`/dj/detail?rid=336355127` (对应'代码时间'的详情介绍) + +### 电台-节目 +说明:登陆后调用此接口,传入`rid`,可查看对应电台的电台节目以及对应 url + +**必选参数:** +`rid`: 电台 的 id + +**接口地址:** +`/dj/sub` + +**调用例子:** +`/dj/program?rid=336355127` (对应'代码时间'的节目列表) + + + ## 离线访问此文档 此文档同时也是 Progressive Web Apps(PWA), 加入了serviceWorker,可离线访问 diff --git a/package.json b/package.json index e2746d3754d..e1e93bea8ca 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "NeteaseCloudMusicApi", - "version": "2.4.6", + "version": "2.5.0", "description": "网易云音乐 NodeJS 版 API", "scripts": { "start": "node app.js", diff --git a/router/album.js b/router/album.js index 4ab7473ce7c..d167f2a4df7 100644 --- a/router/album.js +++ b/router/album.js @@ -1,18 +1,24 @@ const express = require("express") const router = express() -const { createRequest } = require("../util/util") +const { createWebAPIRequest } = require("../util/util") router.get("/", (req, res) => { + const cookie = req.get('Cookie') ? req.get('Cookie') : '' + const data = { + "csrf_token": "" + } const id = req.query.id - createRequest(`/api/album/${id}`, 'GET', null) - .then(result => { - res.setHeader("Content-Type", "application/json") - res.send(result) - }) - .catch(err => { - res.status(502).send('fetch error') - }) + createWebAPIRequest( + 'music.163.com', + `/weapi/v1/album/${id}`, + 'POST', + data, + cookie, + music_req => { + res.send(music_req) + }, + err => res.status(502).send('fetch error') + ) }) - module.exports = router \ No newline at end of file diff --git a/router/artist_album.js b/router/artist_album.js index e1fff591afe..732ee2b63a2 100644 --- a/router/artist_album.js +++ b/router/artist_album.js @@ -1,19 +1,25 @@ const express = require("express") const router = express() -const { createRequest } = require("../util/util") +const { createWebAPIRequest } = require("../util/util") router.get("/", (req, res) => { + const cookie = req.get('Cookie') ? req.get('Cookie') : '' const id = req.query.id - const offset = req.query.offset || 0 - const limit = req.query.limit || 50 - createRequest(`/api/artist/albums/${id}?offset=${offset}&limit=${limit}`, 'GET', null) - .then(result => { - res.setHeader("Content-Type", "application/json") - res.send(result) - }) - .catch(err => { - res.status(502).send('fetch error') - }) + const data = { + 'offset': req.query.offset || 0, + 'total': true, + 'limit': req.query.limit || 30, + "csrf_token": "" + } + createWebAPIRequest( + 'music.163.com', + `/weapi/artist/albums/${id}`, + 'POST', + data, + cookie, + music_req => res.send(music_req), + err => res.status(502).send('fetch error') + ) }) diff --git a/router/artists.js b/router/artists.js index 7046849ab53..6e01733d08e 100644 --- a/router/artists.js +++ b/router/artists.js @@ -6,7 +6,7 @@ router.get("/", (req, res) => { const id = req.query.id const offset = req.query.offset || 0 const limit = req.query.limit || 50 - createRequest(`/api/artist/${id}?offset=${offset}&limit=${limit}`, 'GET', null) + createRequest(`/weapi/v1/artist/${id}?offset=${offset}&limit=${limit}`, 'GET', null) .then(result => { res.setHeader("Content-Type", "application/json") res.send(result) diff --git a/router/artists_desc.js b/router/artists_desc.js new file mode 100644 index 00000000000..21fe456cde6 --- /dev/null +++ b/router/artists_desc.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 id = req.query.id + const data = { + id, + "csrf_token": "" + } + createWebAPIRequest( + 'music.163.com', + `/weapi/artist/introduction`, + 'POST', + data, + cookie, + music_req => res.send(music_req), + err => res.status(502).send('fetch error') + ) +}) + + +module.exports = router \ No newline at end of file diff --git a/router/artists_mv.js b/router/artists_mv.js new file mode 100644 index 00000000000..1c435c44e04 --- /dev/null +++ b/router/artists_mv.js @@ -0,0 +1,27 @@ +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 id = req.query.id + const data = { + artistId: id, + "total": true, + "offset": req.query.offset, + "limit": req.query.limit, + "csrf_token": "" + } + createWebAPIRequest( + 'music.163.com', + `/weapi/artist/mvs`, + 'POST', + data, + cookie, + music_req => res.send(music_req), + err => res.status(502).send('fetch error') + ) +}) + + +module.exports = router \ No newline at end of file diff --git a/router/songDetail.js b/router/banner.js similarity index 78% rename from router/songDetail.js rename to router/banner.js index c7ba8509729..3af6ae219f7 100644 --- a/router/songDetail.js +++ b/router/banner.js @@ -3,8 +3,7 @@ const router = express() const { createRequest } = require("../util/util") router.get("/", (req, res) => { - const ids = req.query.ids - createRequest(`/api/song/detail?ids=%5B${ids}%5D`, 'GET', null) + createRequest('/api/v2/banner/get', 'GET', null) .then(result => { res.setHeader("Content-Type", "application/json") res.send(result) diff --git a/router/check_music.js b/router/check_music.js new file mode 100644 index 00000000000..a32b7ec0e8f --- /dev/null +++ b/router/check_music.js @@ -0,0 +1,34 @@ +const express = require("express") +const router = express() +const request = require("request") +const { createWebAPIRequest } = require("../util/util") +router.get("/", (req, res) => { + const id = parseInt(req.query.id) + const br = parseInt(req.query.br || 999000) + const data = { + "ids": [id], + "br": br, + "csrf_token": "" + } + const cookie = req.get('Cookie') ? req.get('Cookie') : '' + + createWebAPIRequest( + 'music.163.com', + '/weapi/song/enhance/player/url', + 'POST', + data, + cookie, + music_req => { + if(JSON.parse(music_req).code==200){ + return res.send({success: true, message: 'ok'}) + } + return res.send({success: false, message: '亲爱的,暂无版权'}); + }, + err => { + res.status(502).send('fetch error') + } + ) +}) + + +module.exports = router \ No newline at end of file diff --git a/router/comment_album.js b/router/comment_album.js new file mode 100644 index 00000000000..984cb7d43f3 --- /dev/null +++ b/router/comment_album.js @@ -0,0 +1,29 @@ +const express = require("express") +const router = express() +const { createWebAPIRequest } = require("../util/util") + +router.get("/", (req, res) => { + const rid=req.query.id + const cookie = req.get('Cookie') ? req.get('Cookie') : '' + const data = { + "offset": req.query.offset || 0, + "rid": rid, + "limit": req.query.limit || 20, + "csrf_token": "" + } + createWebAPIRequest( + 'music.163.com', + `/weapi/v1/resource/comments/R_AL_3_${rid}/?csrf_token=`, + 'POST', + data, + cookie, + music_req => { + res.send(music_req) + console.log(Object.keys(JSON.parse(music_req))) + console.log(JSON.parse(music_req).comments.length)//100 + }, + err => res.status(502).send('fetch error') + ) +}) + +module.exports = router \ No newline at end of file diff --git a/router/comment_dj.js b/router/comment_dj.js new file mode 100644 index 00000000000..cd3d26d8333 --- /dev/null +++ b/router/comment_dj.js @@ -0,0 +1,29 @@ +const express = require("express") +const router = express() +const { createWebAPIRequest } = require("../util/util") + +router.get("/", (req, res) => { + const rid=req.query.id + const cookie = req.get('Cookie') ? req.get('Cookie') : '' + const data = { + "offset": req.query.offset || 0, + "rid": rid, + "limit": req.query.limit || 20, + "csrf_token": "" + } + createWebAPIRequest( + 'music.163.com', + `/weapi/v1/resource/comments/A_DJ_1_${rid}/?csrf_token=`, + 'POST', + data, + cookie, + music_req => { + res.send(music_req) + console.log(Object.keys(JSON.parse(music_req))) + console.log(JSON.parse(music_req).comments.length)//100 + }, + err => res.status(502).send('fetch error') + ) +}) + +module.exports = router \ No newline at end of file diff --git a/router/comment_like.js b/router/comment_like.js new file mode 100644 index 00000000000..530c7e90439 --- /dev/null +++ b/router/comment_like.js @@ -0,0 +1,30 @@ +//comment like +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 id = req.query.id + const data = { + "threadId": req.query.origin, + commentId:id, + "csrf_token": "" + } + const action=(req.query.t==1?'like':'unlike') + + const url = `/weapi/v1/comment/${action}` + createWebAPIRequest( + 'music.163.com', + url, + 'POST', + data, + cookie, + music_req => res.send(music_req), + err => res.status(502).send('fetch error') + ) +}) + + + +module.exports = router \ No newline at end of file diff --git a/router/comment.js b/router/comment_music.js similarity index 77% rename from router/comment.js rename to router/comment_music.js index b9c1ac1c29c..cbfd39e5f29 100644 --- a/router/comment.js +++ b/router/comment_music.js @@ -17,7 +17,11 @@ router.get("/", (req, res) => { 'POST', data, cookie, - music_req => res.send(music_req), + music_req => { + res.send(music_req) + console.log(Object.keys(JSON.parse(music_req))) + console.log(JSON.parse(music_req).comments.length)//100 + }, err => res.status(502).send('fetch error') ) }) diff --git a/router/comment_mv.js b/router/comment_mv.js new file mode 100644 index 00000000000..d99ef02f25f --- /dev/null +++ b/router/comment_mv.js @@ -0,0 +1,29 @@ +const express = require("express") +const router = express() +const { createWebAPIRequest } = require("../util/util") + +router.get("/", (req, res) => { + const rid=req.query.id + const cookie = req.get('Cookie') ? req.get('Cookie') : '' + const data = { + "offset": req.query.offset || 0, + "rid": rid, + "limit": req.query.limit || 20, + "csrf_token": "" + } + createWebAPIRequest( + 'music.163.com', + `/weapi/v1/resource/comments/R_MV_5_${rid}/?csrf_token=`, + 'POST', + data, + cookie, + music_req => { + res.send(music_req) + console.log(Object.keys(JSON.parse(music_req))) + console.log(JSON.parse(music_req).comments.length)//100 + }, + err => res.status(502).send('fetch error') + ) +}) + +module.exports = router \ No newline at end of file diff --git a/router/comment_playlist.js b/router/comment_playlist.js new file mode 100644 index 00000000000..16f837128ef --- /dev/null +++ b/router/comment_playlist.js @@ -0,0 +1,29 @@ +const express = require("express") +const router = express() +const { createWebAPIRequest } = require("../util/util") + +router.get("/", (req, res) => { + const rid=req.query.id + const cookie = req.get('Cookie') ? req.get('Cookie') : '' + const data = { + "offset": req.query.offset || 0, + "rid": rid, + "limit": req.query.limit || 20, + "csrf_token": "" + } + createWebAPIRequest( + 'music.163.com', + `/weapi/v1/resource/comments/A_PL_0_${rid}/?csrf_token=`, + 'POST', + data, + cookie, + music_req => { + res.send(music_req) + console.log(Object.keys(JSON.parse(music_req))) + console.log(JSON.parse(music_req).comments.length)//100 + }, + err => res.status(502).send('fetch error') + ) +}) + +module.exports = router \ No newline at end of file diff --git a/router/daily_signin.js b/router/daily_signin.js index 1027b04434e..e0b53e80543 100644 --- a/router/daily_signin.js +++ b/router/daily_signin.js @@ -1,3 +1,4 @@ +// 签到 const express = require("express") const router = express() const { createWebAPIRequest } = require("../util/util") @@ -12,7 +13,7 @@ router.get("/", (req, res) => { // 'android': {'code': 301}, 'web': {'code': 301}} let type = req.query.type || 0 //0为安卓端签到 3点经验,1为网页签到,2点经验 - const action = `http://music.163.com/weapi/point/dailyTask?type=${type}` + const action = `/weapi/point/dailyTask?type=${type}` createWebAPIRequest( 'music.163.com', action, diff --git a/router/dj_catelist.js b/router/dj_catelist.js new file mode 100644 index 00000000000..15aba77ba75 --- /dev/null +++ b/router/dj_catelist.js @@ -0,0 +1,23 @@ +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 = { + "csrf_token": "" + } + createWebAPIRequest( + 'music.163.com', + '/weapi/djradio/category/get', + 'POST', + data, + cookie, + music_req => { + res.send(music_req) + }, + err => res.status(502).send('fetch error') + ) +}) + +module.exports = router \ No newline at end of file diff --git a/router/dj_detail.js b/router/dj_detail.js new file mode 100644 index 00000000000..c6aee6119ea --- /dev/null +++ b/router/dj_detail.js @@ -0,0 +1,27 @@ +const express = require("express") +const router = express() +const { createWebAPIRequest } = require("../util/util") + +router.get("/", (req, res) => { + const rid=req.query.rid + const cookie = req.get('Cookie') ? req.get('Cookie') : '' + const data = { + 'id': rid, + "csrf_token": "" + } + createWebAPIRequest( + 'music.163.com', + '/weapi/djradio/get', + 'POST', + data, + cookie, + music_req => { + res.send(music_req) + console.log(Object.keys(JSON.parse(music_req))) + console.log(JSON.parse(music_req).comments.length)//100 + }, + err => res.status(502).send('fetch error') + ) +}) + +module.exports = router \ No newline at end of file diff --git a/router/dj_hot.js b/router/dj_hot.js new file mode 100644 index 00000000000..401f104b824 --- /dev/null +++ b/router/dj_hot.js @@ -0,0 +1,32 @@ +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 = { + 'cat': req.query.type, + cateId: req.query.type, + type: req.query.type, + categoryId: req.query.type, + category: req.query.type, + limit: req.query.limit, + offset: req.query.offset, + "csrf_token": "" + } + createWebAPIRequest( + 'music.163.com', + '/weapi/djradio/hot/v1', + 'POST', + data, + cookie, + music_req => { + res.send(music_req) + console.log(Object.keys(JSON.parse(music_req))) + console.log(JSON.parse(music_req).comments.length)//100 + }, + err => res.status(502).send('fetch error') + ) +}) + +module.exports = router \ No newline at end of file diff --git a/router/dj_program.js b/router/dj_program.js new file mode 100644 index 00000000000..d23711d5aa2 --- /dev/null +++ b/router/dj_program.js @@ -0,0 +1,30 @@ +const express = require("express") +const router = express() +const { createWebAPIRequest } = require("../util/util") + +router.get("/", (req, res) => { + const rid=req.query.rid + const cookie = req.get('Cookie') ? req.get('Cookie') : '' + const data = { + 'asc': req.query.asc, + 'radioId': rid, + 'limit': req.query.limit, + 'offset': req.query.offset, + "csrf_token": "" + } + createWebAPIRequest( + 'music.163.com', + '/weapi/dj/program/byradio', + 'POST', + data, + cookie, + music_req => { + res.send(music_req) + console.log(Object.keys(JSON.parse(music_req))) + console.log(JSON.parse(music_req).comments.length)//100 + }, + err => res.status(502).send('fetch error') + ) +}) + +module.exports = router \ No newline at end of file diff --git a/router/dj_program_detail.js b/router/dj_program_detail.js new file mode 100644 index 00000000000..4faaa236359 --- /dev/null +++ b/router/dj_program_detail.js @@ -0,0 +1,26 @@ +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 = { + 'id': req.query.id, + "csrf_token": "" + } + createWebAPIRequest( + 'music.163.com', + '/weapi/dj/program/detail', + 'POST', + data, + cookie, + music_req => { + res.send(music_req) + console.log(Object.keys(JSON.parse(music_req))) + console.log(JSON.parse(music_req).comments.length)//100 + }, + err => res.status(502).send('fetch error') + ) +}) + +module.exports = router \ No newline at end of file diff --git a/router/dj_recommend.js b/router/dj_recommend.js new file mode 100644 index 00000000000..45539d10da3 --- /dev/null +++ b/router/dj_recommend.js @@ -0,0 +1,25 @@ +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 = { + "csrf_token": "" + } + createWebAPIRequest( + 'music.163.com', + '/weapi/djradio/recommend/v1', + 'POST', + data, + cookie, + music_req => { + res.send(music_req) + console.log(Object.keys(JSON.parse(music_req))) + console.log(JSON.parse(music_req).comments.length)//100 + }, + err => res.status(502).send('fetch error') + ) +}) + +module.exports = router \ No newline at end of file diff --git a/router/dj_recommend_type.js b/router/dj_recommend_type.js new file mode 100644 index 00000000000..7f22333c031 --- /dev/null +++ b/router/dj_recommend_type.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 = { + cateId: req.query.type, + "csrf_token": "" + } + createWebAPIRequest( + 'music.163.com', + '/weapi/djradio/recommend', + 'POST', + data, + cookie, + music_req => { + res.send(music_req) + }, + err => res.status(502).send('fetch error') + ) +}) + +module.exports = router \ No newline at end of file diff --git a/router/dj_sub.js b/router/dj_sub.js new file mode 100644 index 00000000000..b0e665ce40a --- /dev/null +++ b/router/dj_sub.js @@ -0,0 +1,25 @@ +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 = { + "id": req.query.rid, + "csrf_token": "" + } + const action=(req.query.t==1?'sub':'unsub') + createWebAPIRequest( + 'music.163.com', + `/weapi/djradio/${action}`, + 'POST', + data, + cookie, + music_req => { + res.send(music_req) + }, + err => res.status(502).send('fetch error') + ) +}) + +module.exports = router \ No newline at end of file diff --git a/router/fm_trash.js b/router/fm_trash.js index c0919de6ca5..19dda077c1f 100644 --- a/router/fm_trash.js +++ b/router/fm_trash.js @@ -12,7 +12,7 @@ router.get("/", (req, res) => { const time = req.query.time || 25 createWebAPIRequest( 'music.163.com', - `/api/radio/trash/add?alg=${alg}&songId=${songid}&time=${time}`, + `/weapi/radio/trash/add?alg=${alg}&songId=${songid}&time=${time}`, 'POST', data, cookie, diff --git a/router/follow.js b/router/follow.js new file mode 100644 index 00000000000..3c7ad462417 --- /dev/null +++ b/router/follow.js @@ -0,0 +1,25 @@ +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 = { + "csrf_token": "" + } + const url = req.query.type == 'add' ? 'follow' : "delfollow" + const id = req.query.id + createWebAPIRequest( + 'music.163.com', + `/weapi/user/${url}/${id}`, + 'POST', + data, + cookie, + music_req => { + res.send(music_req) + }, + err => res.status(502).send('fetch error') + ) +}) + +module.exports = router \ No newline at end of file diff --git a/router/like.js b/router/like.js index f23b6af6e2f..f037152b46f 100644 --- a/router/like.js +++ b/router/like.js @@ -9,11 +9,12 @@ router.get("/", (req, res) => { } const trackId = req.query.id const like = req.query.like || true - const alg = "itembased" + const alg = req.query.alg || "itembased" const time = req.query.time || 25 + console.log(alg) createWebAPIRequest( 'music.163.com', - `/api/radio/like?alg=${alg}&trackId=${trackId}&like=${like}&time=${time}`, + `/weapi/radio/like?alg=${alg}&trackId=${trackId}&like=${like}&time=${time}`, 'POST', data, cookie, diff --git a/router/likelist.js b/router/likelist.js new file mode 100644 index 00000000000..043631477bd --- /dev/null +++ b/router/likelist.js @@ -0,0 +1,27 @@ +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 = { + uid: req.query.uid, + "csrf_token": "" + } + createWebAPIRequest( + 'music.163.com', + `/weapi/song/like/get`, + 'POST', + data, + cookie, + music_req => { + res.send(music_req) + console.log(JSON.parse(music_req).ids.length) + }, + err => res.status(502).send('fetch error') + ) +}) + + + +module.exports = router \ No newline at end of file diff --git a/router/logWeb.js b/router/logWeb.js index 04388ddfb26..06e7fcb1893 100644 --- a/router/logWeb.js +++ b/router/logWeb.js @@ -5,14 +5,12 @@ const { createWebAPIRequest } = require("../util/util") router.get("/", (req, res) => { const cookie = req.get('Cookie') ? req.get('Cookie') : '' const data = { - "action": req.query.action, - "json": req.query.json, "csrf_token": "", } createWebAPIRequest( 'music.163.com', - '/weapi/log/web', + '/weapi/feedback/weblog', 'POST', data, cookie, diff --git a/router/login_refresh.js b/router/login_refresh.js new file mode 100644 index 00000000000..bc39e4ad95a --- /dev/null +++ b/router/login_refresh.js @@ -0,0 +1,29 @@ +const express = require("express") +const router = express() +const { createWebAPIRequest } = require("../util/util") + +router.get("/", (req, res) => { + const cookie = req.get('Cookie') ? req.get('Cookie') : '' + let csrf = req.query.t || '' + for (let i in cookie) { + if (cookie[i].name == '__csrf') { + csrf = cookie.value + } + } + const data = { + "csrf_token": csrf + } + createWebAPIRequest( + 'music.163.com', + `/weapi/login/token/refresh?csrf_token=${csrf}`, + 'POST', + data, + cookie, + music_req => { + res.send(music_req) + }, + err => res.status(502).send('fetch error') + ) +}) + +module.exports = router \ No newline at end of file diff --git a/router/musicUrl.js b/router/musicUrl.js index e3b72a6573f..f02dfbc3384 100644 --- a/router/musicUrl.js +++ b/router/musicUrl.js @@ -3,8 +3,8 @@ const router = express() const { createWebAPIRequest } = require("../util/util") router.get("/", (req, res) => { - const id = parseInt(req.query.id) - const br = parseInt(req.query.br || 999000) + const id = req.query.id + const br = req.query.br || 999000 const data = { "ids": [id], "br": br, diff --git a/router/mv_first.js b/router/mv_first.js new file mode 100644 index 00000000000..a81558bd0aa --- /dev/null +++ b/router/mv_first.js @@ -0,0 +1,27 @@ +//最新mv +const express = require("express") +const router = express() +const { createWebAPIRequest } = require("../util/util") + +// type ALL, ZH,EA,KR,JP +router.get("/", (req, res) => { + const cookie = req.get('Cookie') ? req.get('Cookie') : '' + const data = { + 'offset': req.query.offset || 0, + 'total': true, + 'limit': req.query.limit || 30, + "csrf_token": "" + } + createWebAPIRequest( + 'music.163.com', + '/weapi/mv/first', + 'POST', + data, + cookie, + music_req => res.send(music_req), + err => res.status(502).send('fetch error') + ) +}) + + +module.exports = router \ No newline at end of file diff --git a/router/play_mv.js b/router/mv_url.js similarity index 100% rename from router/play_mv.js rename to router/mv_url.js diff --git a/router/new_albums.js b/router/new_albums.js deleted file mode 100644 index 32ad837d9c7..00000000000 --- a/router/new_albums.js +++ /dev/null @@ -1,19 +0,0 @@ -const express = require("express") -const router = express() -const { createRequest } = require("../util/util") - -router.get("/", (req, res) => { - const offset = req.query.offset || 0 - const limit = req.query.limit || 50 - createRequest(`/api/album/new?area=ALL&offset=${offset}&total=true&limit=${limit}`, 'GET', null) - .then(result => { - res.setHeader("Content-Type", "application/json") - res.send(result) - }) - .catch(err => { - res.status(502).send('fetch error') - }) -}) - - -module.exports = router \ No newline at end of file diff --git a/router/personal_fm.js b/router/personal_fm.js index 4439e2feb55..d5618264848 100644 --- a/router/personal_fm.js +++ b/router/personal_fm.js @@ -10,7 +10,7 @@ router.get("/", (req, res) => { createWebAPIRequest( 'music.163.com', - 'http://music.163.com/api/radio/get', + '/weapi/v1/radio/get', 'POST', data, cookie, diff --git a/router/personalized.js b/router/personalized.js new file mode 100644 index 00000000000..50376b25a44 --- /dev/null +++ b/router/personalized.js @@ -0,0 +1,23 @@ +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 = { + } + createWebAPIRequest( + 'music.163.com', + '/api/personalized/playlist', + 'POST', + data, + cookie, + music_req => { + res.send(music_req) + }, + err => res.status(502).send('fetch error') + ) +}) + + +module.exports = router \ No newline at end of file diff --git a/router/personalized_djprogram.js b/router/personalized_djprogram.js new file mode 100644 index 00000000000..efe4b480cc7 --- /dev/null +++ b/router/personalized_djprogram.js @@ -0,0 +1,23 @@ +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 = { + } + createWebAPIRequest( + 'music.163.com', + '/api/personalized/djprogram', + 'POST', + data, + cookie, + music_req => { + res.send(music_req) + }, + err => res.status(502).send('fetch error') + ) +}) + + +module.exports = router \ No newline at end of file diff --git a/router/personalized_mv.js b/router/personalized_mv.js new file mode 100644 index 00000000000..53367277916 --- /dev/null +++ b/router/personalized_mv.js @@ -0,0 +1,23 @@ +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 = { + } + createWebAPIRequest( + 'music.163.com', + '/api/personalized/mv', + 'POST', + data, + cookie, + music_req => { + res.send(music_req) + }, + err => res.status(502).send('fetch error') + ) +}) + + +module.exports = router \ No newline at end of file diff --git a/router/personalized_newsong.js b/router/personalized_newsong.js new file mode 100644 index 00000000000..e2e59ef6663 --- /dev/null +++ b/router/personalized_newsong.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: "recommend" + } + createWebAPIRequest( + 'music.163.com', + '/api/personalized/newsong', + 'POST', + data, + cookie, + music_req => { + res.send(music_req) + }, + err => res.status(502).send('fetch error') + ) +}) + + +module.exports = router \ No newline at end of file diff --git a/router/personalized_privatecontent.js b/router/personalized_privatecontent.js new file mode 100644 index 00000000000..502a0c2875a --- /dev/null +++ b/router/personalized_privatecontent.js @@ -0,0 +1,23 @@ +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 = { + } + createWebAPIRequest( + 'music.163.com', + '/api/personalized/privatecontent', + 'POST', + data, + cookie, + music_req => { + res.send(music_req) + }, + err => res.status(502).send('fetch error') + ) +}) + + +module.exports = router \ No newline at end of file diff --git a/router/playlist_catlist.js b/router/playlist_catlist.js new file mode 100644 index 00000000000..fc88e1caa73 --- /dev/null +++ b/router/playlist_catlist.js @@ -0,0 +1,23 @@ +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 = { + "csrf_token": "" + } + createWebAPIRequest( + 'music.163.com', + '/weapi/playlist/catalogue', + 'POST', + data, + cookie, + music_req => { + res.send(music_req) + }, + err => res.status(502).send('fetch error') + ) +}) + +module.exports = router \ No newline at end of file diff --git a/router/playlistDetail.js b/router/playlist_detail.js similarity index 100% rename from router/playlistDetail.js rename to router/playlist_detail.js diff --git a/router/playlist_hot.js b/router/playlist_hot.js new file mode 100644 index 00000000000..f24c0586bee --- /dev/null +++ b/router/playlist_hot.js @@ -0,0 +1,22 @@ +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 = { + } + createWebAPIRequest( + 'music.163.com', + '/api/playlist/hottags', + 'POST', + data, + cookie, + music_req => { + res.send(music_req) + }, + err => res.status(502).send('fetch error') + ) +}) + +module.exports = router \ No newline at end of file diff --git a/router/playlistTracks.js b/router/playlist_tracks.js similarity index 88% rename from router/playlistTracks.js rename to router/playlist_tracks.js index 290c4b156fb..5f585a010c3 100644 --- a/router/playlistTracks.js +++ b/router/playlist_tracks.js @@ -1,7 +1,7 @@ const express = require("express") const router = express() const { createWebAPIRequest } = require("../util/util") - +//收藏单曲到歌单,从歌单删除歌曲 op=del,add;pid=歌单id,tracks=歌曲id router.get("/", (req, res) => { const op = req.query.op const pid = req.query.pid diff --git a/router/program_recommend.js b/router/program_recommend.js new file mode 100644 index 00000000000..e341dc235d9 --- /dev/null +++ b/router/program_recommend.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 = { + cateId: req.query.type, + "csrf_token": "" + } + createWebAPIRequest( + 'music.163.com', + '/weapi/program/recommend/v1', + 'POST', + data, + cookie, + music_req => { + res.send(music_req) + }, + err => res.status(502).send('fetch error') + ) +}) + +module.exports = router \ No newline at end of file diff --git a/router/recommend_dislike.js b/router/recommend_dislike.js new file mode 100644 index 00000000000..d5618264848 --- /dev/null +++ b/router/recommend_dislike.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 = { + "csrf_token": "" + } + + createWebAPIRequest( + 'music.163.com', + '/weapi/v1/radio/get', + 'POST', + data, + cookie, + music_req => res.send(music_req), + err => res.status(502).send('fetch error') + ) +}) + + + +module.exports = router \ No newline at end of file diff --git a/router/recommendResource.js b/router/recommend_resource.js similarity index 100% rename from router/recommendResource.js rename to router/recommend_resource.js diff --git a/router/recommendSongs.js b/router/recommend_songs.js similarity index 100% rename from router/recommendSongs.js rename to router/recommend_songs.js diff --git a/router/resource_like.js b/router/resource_like.js new file mode 100644 index 00000000000..1b8be8cb94e --- /dev/null +++ b/router/resource_like.js @@ -0,0 +1,25 @@ +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 = { + "threadId": req.query.id, + "csrf_token": "" + } + const action = (req.query.t == 1 ? 'like' : 'unlike') + createWebAPIRequest( + 'music.163.com', + `/weapi/resource/${action}`, + 'POST', + data, + cookie, + music_req => { + res.send(music_req) + }, + err => res.status(502).send('fetch error') + ) +}) + +module.exports = router \ No newline at end of file diff --git a/router/search_hot.js b/router/search_hot.js new file mode 100644 index 00000000000..2595ab8d23c --- /dev/null +++ b/router/search_hot.js @@ -0,0 +1,26 @@ +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 = { + "csrf_token": "", + type: req.query.type || 1, + s: keywords || req.query.keywords || '' + } + + createWebAPIRequest( + 'music.163.com', + '/api/search/hot?type=1', + 'POST', + data, + cookie, + music_req => res.send(music_req), + err => res.status(502).send('fetch error') + ) +}) + + + +module.exports = router \ No newline at end of file diff --git a/router/search_multimatch.js b/router/search_multimatch.js new file mode 100644 index 00000000000..4efdd1a6f6e --- /dev/null +++ b/router/search_multimatch.js @@ -0,0 +1,29 @@ +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 = { + "csrf_token": "", + type: req.query.type || 1, + s: req.query.keywords || req.query.keywords || '' + } + + createWebAPIRequest( + 'music.163.com', + '/weapi/search/suggest/multimatch', + 'POST', + data, + cookie, + music_req => { + res.send(music_req) + console.log(Object.keys(JSON.parse(music_req).result)) + }, + err => res.status(502).send('fetch error') + ) +}) + + + +module.exports = router \ No newline at end of file diff --git a/router/search_suggest.js b/router/search_suggest.js new file mode 100644 index 00000000000..1832cad3380 --- /dev/null +++ b/router/search_suggest.js @@ -0,0 +1,27 @@ +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 = { + "csrf_token": "", + s: req.query.keywords || req.query.keywords || '' + } + + createWebAPIRequest( + 'music.163.com', + '/weapi/search/suggest/web', + 'POST', + data, + cookie, + music_req => { + res.send(music_req) + }, + err => res.status(502).send('fetch error') + ) +}) + + + +module.exports = router \ No newline at end of file diff --git a/router/simi_artists.js b/router/simi_artists.js new file mode 100644 index 00000000000..e1fe87602a6 --- /dev/null +++ b/router/simi_artists.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 id = req.query.id + const data = { + artistid:id, + "csrf_token": "" + } + createWebAPIRequest( + 'music.163.com', + `/weapi/discovery/simiArtist`, + 'POST', + data, + cookie, + music_req => res.send(music_req), + err => res.status(502).send('fetch error') + ) +}) + + +module.exports = router \ No newline at end of file diff --git a/router/simi_mv.js b/router/simi_mv.js new file mode 100644 index 00000000000..9ea2dedbaeb --- /dev/null +++ b/router/simi_mv.js @@ -0,0 +1,22 @@ +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 = { + mvid: req.query.mvid + } + createWebAPIRequest( + 'music.163.com', + '/weapi/discovery/simiMV', + 'POST', + data, + cookie, + music_req => res.send(music_req), + err => res.status(502).send('fetch error') + ) +}) + + +module.exports = router \ No newline at end of file diff --git a/router/simi_playlist.js b/router/simi_playlist.js new file mode 100644 index 00000000000..42913ab1ff8 --- /dev/null +++ b/router/simi_playlist.js @@ -0,0 +1,26 @@ +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 = { + songid: req.query.id, + offset: req.query.offset || 0, + limit: req.query.limit || 50 + } + createWebAPIRequest( + 'music.163.com', + '/weapi/discovery/simiPlaylist', + 'POST', + data, + cookie, + music_req => { + res.send(music_req) + // console.log(JSON.parse(music_req).playlists.length) + }, + err => res.status(502).send('fetch error') + ) +}) + +module.exports = router \ No newline at end of file diff --git a/router/simi_song.js b/router/simi_song.js new file mode 100644 index 00000000000..21230ca297f --- /dev/null +++ b/router/simi_song.js @@ -0,0 +1,26 @@ +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 = { + songid: req.query.id, + offset: req.query.offset || 0, + limit: req.query.limit || 50 + } + createWebAPIRequest( + 'music.163.com', + '/weapi/v1/discovery/simiSong', + 'POST', + data, + cookie, + music_req => { + res.send(music_req) + // console.log(JSON.parse(music_req).playlists.length) + }, + err => res.status(502).send('fetch error') + ) +}) + +module.exports = router \ No newline at end of file diff --git a/router/simi_user.js b/router/simi_user.js new file mode 100644 index 00000000000..795fbd01e94 --- /dev/null +++ b/router/simi_user.js @@ -0,0 +1,25 @@ +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 = { + songid: req.query.id, + offset: req.query.offset || 0, + limit: req.query.limit || 50 + } + createWebAPIRequest( + 'music.163.com', + '/weapi/discovery/simiUser', + 'POST', + data, + cookie, + music_req => { + res.send(music_req) + }, + err => res.status(502).send('fetch error') + ) +}) + +module.exports = router \ No newline at end of file diff --git a/router/song_detail.js b/router/song_detail.js new file mode 100644 index 00000000000..2e1e866b393 --- /dev/null +++ b/router/song_detail.js @@ -0,0 +1,27 @@ +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 id = parseInt(req.query.ids) + const data = { + "id": id, + 'c': JSON.stringify([{ id: id }]), + "ids": '[' + id + ']', + "csrf_token": "" + } + createWebAPIRequest( + 'music.163.com', + '/weapi/v3/song/detail', + 'POST', + data, + cookie, + music_req => { + res.send(music_req) + }, + err => res.status(502).send('fetch error') + ) +}) + +module.exports = router \ No newline at end of file diff --git a/router/top_album.js b/router/top_album.js new file mode 100644 index 00000000000..cb4f6ea67a4 --- /dev/null +++ b/router/top_album.js @@ -0,0 +1,31 @@ +//最新mv +const express = require("express") +const router = express() +const { createWebAPIRequest } = require("../util/util") + +// type ALL, ZH,EA,KR,JP +router.get("/", (req, res) => { + const cookie = req.get('Cookie') ? req.get('Cookie') : '' + const data = { + 'offset': req.query.offset, + 'total': true, + 'limit': req.query.limit, + 'area': req.query.type, + "csrf_token": "" + } + createWebAPIRequest( + 'music.163.com', + '/weapi/album/new', + 'POST', + data, + cookie, + music_req => { + res.send(music_req) + // console.log(JSON.parse(music_req).albums.length) + }, + err => res.status(502).send('fetch error') + ) +}) + + +module.exports = router \ No newline at end of file diff --git a/router/top_mv.js b/router/top_mv.js new file mode 100644 index 00000000000..938d2da9157 --- /dev/null +++ b/router/top_mv.js @@ -0,0 +1,31 @@ +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 = { + 'offset': req.query.offset || 0, + 'total': true, + 'limit': req.query.limit || 30, + "csrf_token": "" + } + + createWebAPIRequest( + 'music.163.com', + '/weapi/mv/toplist', + 'POST', + data, + cookie, + music_req => { + res.setHeader("Content-Type", "application/json") + res.send(music_req) + console.log(Object.keys(JSON.parse(music_req).result)) + }, + err => res.status(502).send('fetch error') + ) +}) + + + +module.exports = router \ No newline at end of file diff --git a/router/top_playlist.js b/router/top_playlist.js index 0d9a5322e86..134712786b3 100644 --- a/router/top_playlist.js +++ b/router/top_playlist.js @@ -1,3 +1,4 @@ +//分类歌单 const express = require("express") const router = express() const { createWebAPIRequest } = require("../util/util") @@ -9,16 +10,18 @@ router.get("/", (req, res) => { cat: req.query.cat || "全部", order: req.query.order || "hot", offset: req.query.offset || 0, - total: req.query.offset ? 'true' : 'false', + total: req.query.total ? 'true' : 'false', limit: req.query.limit || 50 } createWebAPIRequest( 'music.163.com', - '/api/playlist/list', + '/weapi/playlist/list', 'POST', data, cookie, - music_req => res.send(music_req), + music_req => { + res.send(music_req) + }, err => res.status(502).send('fetch error') ) }) diff --git a/router/top_playlist_highquality.js b/router/top_playlist_highquality.js new file mode 100644 index 00000000000..4b05476e100 --- /dev/null +++ b/router/top_playlist_highquality.js @@ -0,0 +1,26 @@ +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 = { + cat: req.query.cat || "全部", + offset: req.query.offset || 0, + limit: req.query.limit || 20 + } + createWebAPIRequest( + 'music.163.com', + '/weapi/playlist/highquality/list', + 'POST', + data, + cookie, + music_req => { + res.send(music_req) + // console.log(JSON.parse(music_req).playlists.length) + }, + err => res.status(502).send('fetch error') + ) +}) + +module.exports = router \ No newline at end of file diff --git a/router/top_songs.js b/router/top_songs.js new file mode 100644 index 00000000000..ef59a9d5612 --- /dev/null +++ b/router/top_songs.js @@ -0,0 +1,30 @@ +//新歌上架 +const express = require("express") +const router = express() +const { createWebAPIRequest } = require("../util/util") + +// type ALL, ZH,EA,KR,JP +router.get("/", (req, res) => { + const cookie = req.get('Cookie') ? req.get('Cookie') : '' + const data = { + 'offset': request.query.offset, + 'total': true, + 'limit': request.query.limit, + 'area': request.query.type, + "csrf_token": "" + } + createWebAPIRequest( + 'music.163.com', + '/weapi/v1/discovery/new/songs', + 'POST', + data, + cookie, + music_req => { + res.send(music_req) + }, + err => res.status(502).send('fetch error') + ) +}) + + +module.exports = router \ No newline at end of file diff --git a/router/toplist.js b/router/toplist.js new file mode 100644 index 00000000000..10e4108b45d --- /dev/null +++ b/router/toplist.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 = { + "csrf_token": "", + } + createWebAPIRequest( + 'music.163.com', + '/weapi/toplist', + 'POST', + data, + cookie, + music_req => { + res.send(music_req) + }, + err => res.status(502).send('fetch error') + ) +}) + +module.exports = router \ No newline at end of file diff --git a/router/toplist_artist.js b/router/toplist_artist.js new file mode 100644 index 00000000000..d578430bc81 --- /dev/null +++ b/router/toplist_artist.js @@ -0,0 +1,25 @@ +//艺术家分类 +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: request.query.type, + "csrf_token": "", + } + createWebAPIRequest( + 'music.163.com', + '/weapi/toplist/artist', + 'POST', + data, + cookie, + music_req => { + res.send(music_req) + }, + err => res.status(502).send('fetch error') + ) +}) + +module.exports = router \ No newline at end of file diff --git a/router/toplist_detail.js b/router/toplist_detail.js new file mode 100644 index 00000000000..2c8cc38ebd6 --- /dev/null +++ b/router/toplist_detail.js @@ -0,0 +1,26 @@ +// 排行榜详情 +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 = { + id: request.query.id, + limit: 20, + "csrf_token": "", + } + createWebAPIRequest( + 'music.163.com', + '/weapi/toplist/detail', + 'POST', + data, + cookie, + music_req => { + res.send(music_req) + }, + err => res.status(502).send('fetch error') + ) +}) + +module.exports = router \ No newline at end of file diff --git a/router/user_audio.js b/router/user_audio.js new file mode 100644 index 00000000000..409b597f026 --- /dev/null +++ b/router/user_audio.js @@ -0,0 +1,29 @@ +const express = require("express") +const router = express() +const { createWebAPIRequest } = require("../util/util") + +router.get("/", (req, res) => { + const data = { + "userId": req.query.uid, + "csrf_token": "" + } + console.log(data) + const cookie = req.get('Cookie') ? req.get('Cookie') : '' + + createWebAPIRequest( + 'music.163.com', + '/weapi/djradio/get/byuser', + 'POST', + data, + cookie, + music_req => { + res.setHeader("Content-Type", "application/json") + res.send(music_req) + }, + err => { + res.status(502).send('fetch error') + } + ) +}) + +module.exports = router \ No newline at end of file diff --git a/router/user_cloud.js b/router/user_cloud.js new file mode 100644 index 00000000000..6e5acbea383 --- /dev/null +++ b/router/user_cloud.js @@ -0,0 +1,29 @@ +const express = require("express") +const router = express() +const { createWebAPIRequest } = require("../util/util") + +router.get("/", (req, res) => { + const data = { + limit: req.query.limit || 10, + offset: req.query.offset || 0, + "csrf_token": "" + } + const cookie = req.get('Cookie') ? req.get('Cookie') : '' + createWebAPIRequest( + 'music.163.com', + '/weapi/v1/cloud/get', + 'POST', + data, + cookie, + music_req => { + res.setHeader("Content-Type", "application/json") + res.send(music_req) + }, + err => { + res.status(502).send('fetch error') + } + ) +}) + + +module.exports = router \ No newline at end of file diff --git a/router/user_cloud_search.js b/router/user_cloud_search.js new file mode 100644 index 00000000000..2fe5ec51243 --- /dev/null +++ b/router/user_cloud_search.js @@ -0,0 +1,29 @@ +const express = require("express") +const router = express() +const { createWebAPIRequest } = require("../util/util") + +router.get("/", (req, res) => { + const data = { + byids: req.query.id, + id: req.query.id, + "csrf_token": "" + } + const cookie = req.get('Cookie') ? req.get('Cookie') : '' + createWebAPIRequest( + 'music.163.com', + '/weapi/v1/cloud/get/byids', + 'POST', + data, + cookie, + music_req => { + res.setHeader("Content-Type", "application/json") + res.send(music_req) + }, + err => { + res.status(502).send('fetch error') + } + ) +}) + + +module.exports = router \ No newline at end of file diff --git a/router/user_detail.js b/router/user_detail.js new file mode 100644 index 00000000000..126e5d577df --- /dev/null +++ b/router/user_detail.js @@ -0,0 +1,25 @@ +// 用户详情 +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 id = req.query.uid + const data = { + "csrf_token": "" + } + createWebAPIRequest( + 'music.163.com', + `/api/v1/user/detail/${id}`, + 'POST', + data, + cookie, + music_req => { + res.send(music_req) + }, + err => res.status(502).send('fetch error') + ) +}) + +module.exports = router \ No newline at end of file diff --git a/router/user_dj.js b/router/user_dj.js new file mode 100644 index 00000000000..c92e5e742be --- /dev/null +++ b/router/user_dj.js @@ -0,0 +1,27 @@ +// 用户电台 +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 id = req.query.uid + const data = { + 'offset': req.query.offset || '0', + 'limit': req.query.limit || 30, + "csrf_token": "" + } + createWebAPIRequest( + 'music.163.com', + `/weapi/dj/program/${id}`, + 'POST', + data, + cookie, + music_req => { + res.send(music_req) + }, + err => res.status(502).send('fetch error') + ) +}) + +module.exports = router \ No newline at end of file diff --git a/router/user_event.js b/router/user_event.js new file mode 100644 index 00000000000..88afb3c94ad --- /dev/null +++ b/router/user_event.js @@ -0,0 +1,26 @@ +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 id = req.query.uid + const data = { + 'time': -1, + 'getcounts': true, + "csrf_token": "" + } + createWebAPIRequest( + 'music.163.com', + `/weapi/event/get/${id}`, + 'POST', + data, + cookie, + music_req => { + res.send(music_req) + }, + err => res.status(502).send('fetch error') + ) +}) + +module.exports = router \ No newline at end of file diff --git a/router/user_followeds.js b/router/user_followeds.js new file mode 100644 index 00000000000..e6788d93a12 --- /dev/null +++ b/router/user_followeds.js @@ -0,0 +1,26 @@ +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 = { + 'userId': req.query.uid, + offset: req.query.offset || '0', + limit: req.query.limit || 30, + "csrf_token": "" + } + createWebAPIRequest( + 'music.163.com', + `/weapi/user/getfolloweds/`, + 'POST', + data, + cookie, + music_req => { + res.send(music_req) + }, + err => res.status(502).send('fetch error') + ) +}) + +module.exports = router \ No newline at end of file diff --git a/router/user_follows.js b/router/user_follows.js new file mode 100644 index 00000000000..250f497d8ad --- /dev/null +++ b/router/user_follows.js @@ -0,0 +1,26 @@ +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 id = req.query.uid + const data = { + offset: req.query.offset || '0', + limit: req.query.limit || 30, + order: true + } + createWebAPIRequest( + 'music.163.com', + `/weapi/user/getfollows/${id}`, + 'POST', + data, + cookie, + music_req => { + res.send(music_req) + }, + err => res.status(502).send('fetch error') + ) +}) + +module.exports = router \ No newline at end of file diff --git a/router/userPlaylist.js b/router/user_playlist.js similarity index 100% rename from router/userPlaylist.js rename to router/user_playlist.js diff --git a/router/user_playrecord.js b/router/user_playrecord.js new file mode 100644 index 00000000000..dfb3bec5f67 --- /dev/null +++ b/router/user_playrecord.js @@ -0,0 +1,29 @@ +//播放记录 +const express = require("express") +const router = express() +const { createWebAPIRequest } = require("../util/util") + +router.get("/", (req, res) => { + const cookie = req.get('Cookie') ? req.get('Cookie') : '' + + // type=1时只返回weekData, type=0时返回allData + const data = { + 'type': req.query.type || 0, + uid: req.query.uid, //用户 id, + "csrf_token": "" + } + const action = `/weapi/v1/play/record` + createWebAPIRequest( + 'music.163.com', + action, + 'POST', + data, + cookie, + music_req => res.send(music_req), + err => res.status(502).send('fetch error') + ) +}) + + + +module.exports = router \ No newline at end of file diff --git a/router/user_subcount.js b/router/user_subcount.js new file mode 100644 index 00000000000..3cc715d4666 --- /dev/null +++ b/router/user_subcount.js @@ -0,0 +1,21 @@ +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 = { + "csrf_token": "" + } + createWebAPIRequest( + 'music.163.com', + '/weapi/subcount', + 'POST', + data, + cookie, + music_req => res.send(music_req), + err => res.status(502).send('fetch error') + ) +}) + +module.exports = router \ No newline at end of file diff --git a/static/banner.png b/static/banner.png new file mode 100644 index 00000000000..fac182a8d14 Binary files /dev/null and b/static/banner.png differ