@sansenjian/qq-music-api 2.2.1 → 2.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +124 -33
- package/README.md +2 -0
- package/dist/app.js +77 -0
- package/dist/config/service-config.js +37 -0
- package/dist/config/user-info.js +59 -0
- package/dist/index.js +3 -0
- package/dist/jest.config.js +52 -0
- package/dist/middlewares/fallback-middleware.js +29 -0
- package/dist/middlewares/koa-cors.js +63 -0
- package/dist/module/apis/UCommon/UCommon.js +10 -0
- package/dist/module/apis/album/getAlbumInfo.js +23 -0
- package/dist/module/apis/comments/getComments.js +24 -0
- package/dist/module/apis/digitalAlbum/getDigitalAlbumLists.js +22 -0
- package/dist/module/apis/downloadQQMusic.js +48 -0
- package/dist/module/apis/extend/getPlaylistTags.js +158 -0
- package/dist/module/apis/music/getLyric.js +32 -0
- package/dist/module/apis/music/getMusicPlay.js +187 -0
- package/dist/module/apis/mv/getMvByTag.js +23 -0
- package/dist/module/apis/radio/getRadioLists.js +26 -0
- package/dist/module/apis/rank/getTopLists.js +35 -0
- package/dist/module/apis/recommend/getDailyRecommend.js +124 -0
- package/dist/module/apis/recommend/getPersonalRecommend.js +114 -0
- package/dist/module/apis/search/getHotKey.js +25 -0
- package/dist/module/apis/search/getSearchByKey.js +32 -0
- package/dist/module/apis/search/getSmartbox.js +40 -0
- package/dist/module/apis/singers/getSimilarSinger.js +24 -0
- package/dist/module/apis/singers/getSingerDesc.js +24 -0
- package/dist/module/apis/singers/getSingerMv.js +23 -0
- package/dist/module/apis/singers/getSingerStarNum.js +23 -0
- package/dist/module/apis/songLists/songListCategories.js +23 -0
- package/dist/module/apis/songLists/songListDetail.js +28 -0
- package/dist/module/apis/songLists/songLists.js +35 -0
- package/dist/module/apis/u_common.js +62 -0
- package/dist/module/apis/user/checkQQLoginQr.js +189 -0
- package/dist/module/apis/user/getQQLoginQr.js +23 -0
- package/dist/module/apis/user/getUserAvatar.js +25 -0
- package/dist/module/apis/user/getUserLikedSongs.js +129 -0
- package/dist/module/apis/user/getUserPlaylists.js +138 -0
- package/dist/module/apis/y_common.js +69 -0
- package/dist/module/config.js +24 -0
- package/dist/module/index.js +72 -0
- package/dist/package.json +120 -0
- package/dist/routers/context/batchGetSongInfo.js +48 -0
- package/dist/routers/context/batchGetSongLists.js +35 -0
- package/dist/routers/context/checkQQLoginQr.js +16 -0
- package/dist/routers/context/cookies.js +36 -0
- package/dist/routers/context/getAlbumInfo.js +22 -0
- package/dist/routers/context/getComments.js +31 -0
- package/dist/routers/context/getDailyRecommend.js +33 -0
- package/dist/routers/context/getDigitalAlbumLists.js +16 -0
- package/dist/routers/context/getDownloadQQMusic.js +16 -0
- package/dist/routers/context/getHotkey.js +20 -0
- package/dist/routers/context/getImageUrl.js +25 -0
- package/dist/routers/context/getLyric.js +29 -0
- package/dist/routers/context/getMusicPlay.js +33 -0
- package/dist/routers/context/getMv.js +51 -0
- package/dist/routers/context/getMvByTag.js +16 -0
- package/dist/routers/context/getMvPlay.js +104 -0
- package/dist/routers/context/getNewDisks.js +52 -0
- package/dist/routers/context/getPersonalRecommend.js +42 -0
- package/dist/routers/context/getPlaylistTags.js +54 -0
- package/dist/routers/context/getQQLoginQr.js +14 -0
- package/dist/routers/context/getRadioLists.js +16 -0
- package/dist/routers/context/getRanks.js +53 -0
- package/dist/routers/context/getRecommend.js +88 -0
- package/dist/routers/context/getSearchByKey.js +32 -0
- package/dist/routers/context/getSimilarSinger.js +27 -0
- package/dist/routers/context/getSingerAlbum.js +48 -0
- package/dist/routers/context/getSingerDesc.js +28 -0
- package/dist/routers/context/getSingerHotsong.js +48 -0
- package/dist/routers/context/getSingerList.js +39 -0
- package/dist/routers/context/getSingerMv.js +36 -0
- package/dist/routers/context/getSingerStarNum.js +27 -0
- package/dist/routers/context/getSmartbox.js +27 -0
- package/dist/routers/context/getSongInfo.js +40 -0
- package/dist/routers/context/getSongListCategories.js +22 -0
- package/dist/routers/context/getSongListDetail.js +17 -0
- package/dist/routers/context/getSongLists.js +25 -0
- package/dist/routers/context/getTicketInfo.js +47 -0
- package/dist/routers/context/getTopLists.js +16 -0
- package/dist/routers/context/getUserAvatar.js +35 -0
- package/dist/routers/context/getUserLikedSongs.js +24 -0
- package/dist/routers/context/getUserPlaylists.js +27 -0
- package/dist/routers/context/index.js +98 -0
- package/dist/routers/router.js +69 -0
- package/dist/routers/types.js +2 -0
- package/dist/routers/util.js +219 -0
- package/dist/scripts/run-tests-with-flags.js +139 -0
- package/dist/types/api.js +55 -0
- package/dist/util/apiResponse.js +88 -0
- package/dist/util/colors.js +19 -0
- package/dist/util/cookie.js +34 -0
- package/dist/util/cookieResolver.js +66 -0
- package/dist/util/loginUtils.js +30 -0
- package/dist/util/lyricParse.js +72 -0
- package/dist/util/request.js +118 -0
- package/docs-dist/404.html +24 -0
- package/docs-dist/CHANGELOG-ARCHITECTURE.html +131 -0
- package/docs-dist/COOKIE_CONFIG_GUIDE.html +39 -0
- package/docs-dist/FALLBACK_MODE_GUIDE.html +101 -0
- package/docs-dist/README.html +447 -0
- package/docs-dist/TEST_USER_PLAYLISTS.html +42 -0
- package/docs-dist/USER_AVATAR_GUIDE.html +100 -0
- package/docs-dist/api/comments.html +48 -0
- package/docs-dist/api/index.html +27 -0
- package/docs-dist/api/music.html +51 -0
- package/docs-dist/api/other.html +33 -0
- package/docs-dist/api/playlist.html +77 -0
- package/docs-dist/api/rank.html +48 -0
- package/docs-dist/api/search.html +62 -0
- package/docs-dist/api/singer.html +47 -0
- package/docs-dist/api/user.html +64 -0
- package/docs-dist/assets/CHANGELOG-ARCHITECTURE.md.r40JGJZK.js +105 -0
- package/docs-dist/assets/CHANGELOG-ARCHITECTURE.md.r40JGJZK.lean.js +1 -0
- package/docs-dist/assets/COOKIE_CONFIG_GUIDE.md.BVXl7WHu.js +13 -0
- package/docs-dist/assets/COOKIE_CONFIG_GUIDE.md.BVXl7WHu.lean.js +1 -0
- package/docs-dist/assets/FALLBACK_MODE_GUIDE.md.BBdcIdh_.js +75 -0
- package/docs-dist/assets/FALLBACK_MODE_GUIDE.md.BBdcIdh_.lean.js +1 -0
- package/docs-dist/assets/README.md.D6Tw0nRd.js +421 -0
- package/docs-dist/assets/README.md.D6Tw0nRd.lean.js +1 -0
- package/docs-dist/assets/TEST_USER_PLAYLISTS.md.DSt20Igj.js +16 -0
- package/docs-dist/assets/TEST_USER_PLAYLISTS.md.DSt20Igj.lean.js +1 -0
- package/docs-dist/assets/USER_AVATAR_GUIDE.md.CVHPs2Dn.js +74 -0
- package/docs-dist/assets/USER_AVATAR_GUIDE.md.CVHPs2Dn.lean.js +1 -0
- package/docs-dist/assets/api_comments.md.79Q_C8Qp.js +22 -0
- package/docs-dist/assets/api_comments.md.79Q_C8Qp.lean.js +1 -0
- package/docs-dist/assets/api_index.md.CU3By8tw.js +1 -0
- package/docs-dist/assets/api_index.md.CU3By8tw.lean.js +1 -0
- package/docs-dist/assets/api_music.md.B1AzLePX.js +25 -0
- package/docs-dist/assets/api_music.md.B1AzLePX.lean.js +1 -0
- package/docs-dist/assets/api_other.md.DCg4bzA7.js +7 -0
- package/docs-dist/assets/api_other.md.DCg4bzA7.lean.js +1 -0
- package/docs-dist/assets/api_playlist.md.8ACJ3QqD.js +51 -0
- package/docs-dist/assets/api_playlist.md.8ACJ3QqD.lean.js +1 -0
- package/docs-dist/assets/api_rank.md.B8IP2ZRy.js +22 -0
- package/docs-dist/assets/api_rank.md.B8IP2ZRy.lean.js +1 -0
- package/docs-dist/assets/api_search.md.DO9J6nvp.js +36 -0
- package/docs-dist/assets/api_search.md.DO9J6nvp.lean.js +1 -0
- package/docs-dist/assets/api_singer.md.CcL32xuN.js +21 -0
- package/docs-dist/assets/api_singer.md.CcL32xuN.lean.js +1 -0
- package/docs-dist/assets/api_user.md.Cb7Ky3Sn.js +38 -0
- package/docs-dist/assets/api_user.md.Cb7Ky3Sn.lean.js +1 -0
- package/docs-dist/assets/app.CSainqD9.js +1 -0
- package/docs-dist/assets/chunks/@localSearchIndexroot.BKleDIv-.js +1 -0
- package/docs-dist/assets/chunks/VPLocalSearchBox.BUBaq7tw.js +9 -0
- package/docs-dist/assets/chunks/framework.aJbMEiY9.js +19 -0
- package/docs-dist/assets/chunks/theme.CzMhU0Ps.js +2 -0
- package/docs-dist/assets/guide_architecture.md.CzgqynmB.js +258 -0
- package/docs-dist/assets/guide_architecture.md.CzgqynmB.lean.js +1 -0
- package/docs-dist/assets/guide_authentication.md.a8yTA8Xe.js +4 -0
- package/docs-dist/assets/guide_authentication.md.a8yTA8Xe.lean.js +1 -0
- package/docs-dist/assets/guide_index.md.BgUUL6fI.js +1 -0
- package/docs-dist/assets/guide_index.md.BgUUL6fI.lean.js +1 -0
- package/docs-dist/assets/guide_installation.md.BCZ4jBl_.js +7 -0
- package/docs-dist/assets/guide_installation.md.BCZ4jBl_.lean.js +1 -0
- package/docs-dist/assets/guide_quickstart.md.9-4dA6wS.js +13 -0
- package/docs-dist/assets/guide_quickstart.md.9-4dA6wS.lean.js +1 -0
- package/docs-dist/assets/index.md.z0hAJioN.js +1 -0
- package/docs-dist/assets/index.md.z0hAJioN.lean.js +1 -0
- package/docs-dist/assets/inter-italic-cyrillic-ext.r48I6akx.woff2 +0 -0
- package/docs-dist/assets/inter-italic-cyrillic.By2_1cv3.woff2 +0 -0
- package/docs-dist/assets/inter-italic-greek-ext.1u6EdAuj.woff2 +0 -0
- package/docs-dist/assets/inter-italic-greek.DJ8dCoTZ.woff2 +0 -0
- package/docs-dist/assets/inter-italic-latin-ext.CN1xVJS-.woff2 +0 -0
- package/docs-dist/assets/inter-italic-latin.C2AdPX0b.woff2 +0 -0
- package/docs-dist/assets/inter-italic-vietnamese.BSbpV94h.woff2 +0 -0
- package/docs-dist/assets/inter-roman-cyrillic-ext.BBPuwvHQ.woff2 +0 -0
- package/docs-dist/assets/inter-roman-cyrillic.C5lxZ8CY.woff2 +0 -0
- package/docs-dist/assets/inter-roman-greek-ext.CqjqNYQ-.woff2 +0 -0
- package/docs-dist/assets/inter-roman-greek.BBVDIX6e.woff2 +0 -0
- package/docs-dist/assets/inter-roman-latin-ext.4ZJIpNVo.woff2 +0 -0
- package/docs-dist/assets/inter-roman-latin.Di8DUHzh.woff2 +0 -0
- package/docs-dist/assets/inter-roman-vietnamese.BjW4sHH5.woff2 +0 -0
- package/docs-dist/assets/reference_response-format.md.VvQTLDZr.js +12 -0
- package/docs-dist/assets/reference_response-format.md.VvQTLDZr.lean.js +1 -0
- package/docs-dist/assets/style.DM4qKDd4.css +1 -0
- package/docs-dist/guide/architecture.html +284 -0
- package/docs-dist/guide/authentication.html +30 -0
- package/docs-dist/guide/index.html +27 -0
- package/docs-dist/guide/installation.html +33 -0
- package/docs-dist/guide/quickstart.html +39 -0
- package/docs-dist/hashmap.json +1 -0
- package/docs-dist/index.html +27 -0
- package/docs-dist/logo.svg +4 -0
- package/docs-dist/reference/response-format.html +38 -0
- package/docs-dist/version.json +7 -0
- package/docs-dist/vp-icons.css +1 -0
- package/package.json +31 -17
- package/.babelrc +0 -7
- package/.dockerignore +0 -5
- package/.editorconfig +0 -31
- package/.eslintrc.json +0 -22
- package/.github/workflows/deploy-docs.yml +0 -54
- package/.github/workflows/release.yml +0 -37
- package/.github/workflows/test.yml +0 -70
- package/.husky/commit-msg +0 -1
- package/.husky/pre-commit +0 -1
- package/.prettierignore +0 -1
- package/.prettierrc +0 -9
- package/AGENTS.md +0 -153
- package/Dockerfile +0 -18
- package/QQ/351/237/263/344/271/220-v0.xmind +0 -0
- package/QQ/351/237/263/344/271/220-v1.xmind +0 -0
- package/app.ts +0 -68
- package/commitlint.config.js +0 -20
- package/config/user-info.ts +0 -71
- package/index.ts +0 -1
- package/jest.config.ts +0 -41
- package/middlewares/koa-cors.ts +0 -81
- package/module/apis/UCommon/UCommon.ts +0 -13
- package/module/apis/album/getAlbumInfo.ts +0 -22
- package/module/apis/comments/getComments.ts +0 -23
- package/module/apis/digitalAlbum/getDigitalAlbumLists.ts +0 -23
- package/module/apis/downloadQQMusic.ts +0 -51
- package/module/apis/music/getLyric.ts +0 -34
- package/module/apis/mv/getMvByTag.ts +0 -24
- package/module/apis/radio/getRadioLists.ts +0 -27
- package/module/apis/rank/getTopLists.ts +0 -37
- package/module/apis/search/getHotKey.ts +0 -24
- package/module/apis/search/getSearchByKey.ts +0 -31
- package/module/apis/search/getSmartbox.ts +0 -43
- package/module/apis/singers/getSimilarSinger.ts +0 -25
- package/module/apis/singers/getSingerDesc.ts +0 -25
- package/module/apis/singers/getSingerMv.ts +0 -24
- package/module/apis/singers/getSingerStarNum.ts +0 -24
- package/module/apis/songLists/songListCategories.ts +0 -22
- package/module/apis/songLists/songListDetail.ts +0 -27
- package/module/apis/songLists/songLists.ts +0 -35
- package/module/apis/u_common.ts +0 -29
- package/module/apis/user/checkQQLoginQr.ts +0 -230
- package/module/apis/user/getQQLoginQr.ts +0 -28
- package/module/apis/user/getUserAvatar.ts +0 -32
- package/module/apis/user/getUserLikedSongs.ts +0 -145
- package/module/apis/user/getUserPlaylists.ts +0 -163
- package/module/apis/y_common.ts +0 -44
- package/module/config.ts +0 -24
- package/module/index.ts +0 -95
- package/music.png +0 -0
- package/pnpm-workspace.yaml +0 -2
- package/public/index.html +0 -430
- package/routers/context/batchGetSongInfo.ts +0 -60
- package/routers/context/batchGetSongLists.ts +0 -46
- package/routers/context/checkQQLoginQr.ts +0 -19
- package/routers/context/cookies.ts +0 -38
- package/routers/context/getAlbumInfo.ts +0 -31
- package/routers/context/getComments.ts +0 -51
- package/routers/context/getDigitalAlbumLists.ts +0 -18
- package/routers/context/getDownloadQQMusic.ts +0 -17
- package/routers/context/getHotkey.ts +0 -25
- package/routers/context/getImageUrl.ts +0 -29
- package/routers/context/getLyric.ts +0 -32
- package/routers/context/getMusicPlay.ts +0 -102
- package/routers/context/getMv.ts +0 -61
- package/routers/context/getMvByTag.ts +0 -18
- package/routers/context/getMvPlay.ts +0 -114
- package/routers/context/getNewDisks.ts +0 -58
- package/routers/context/getQQLoginQr.ts +0 -16
- package/routers/context/getRadioLists.ts +0 -18
- package/routers/context/getRanks.ts +0 -67
- package/routers/context/getRecommend.ts +0 -92
- package/routers/context/getSearchByKey.ts +0 -34
- package/routers/context/getSimilarSinger.ts +0 -29
- package/routers/context/getSingerAlbum.ts +0 -58
- package/routers/context/getSingerDesc.ts +0 -30
- package/routers/context/getSingerHotsong.ts +0 -58
- package/routers/context/getSingerList.ts +0 -56
- package/routers/context/getSingerMv.ts +0 -41
- package/routers/context/getSingerStarNum.ts +0 -29
- package/routers/context/getSmartbox.ts +0 -27
- package/routers/context/getSongInfo.ts +0 -51
- package/routers/context/getSongListCategories.ts +0 -23
- package/routers/context/getSongListDetail.ts +0 -22
- package/routers/context/getSongLists.ts +0 -30
- package/routers/context/getTicketInfo.ts +0 -51
- package/routers/context/getTopLists.ts +0 -18
- package/routers/context/getUserAvatar.ts +0 -53
- package/routers/context/getUserLikedSongs.ts +0 -28
- package/routers/context/getUserPlaylists.ts +0 -29
- package/routers/context/index.ts +0 -87
- package/routers/router.ts +0 -88
- package/routers/types.ts +0 -18
- package/routers/util.ts +0 -231
- package/screenshot/album-image.png +0 -0
- package/screenshot/batchGetSongInfo.png +0 -0
- package/screenshot/batchGetSongLists.png +0 -0
- package/screenshot/downloadQQMusic.png +0 -0
- package/screenshot/get-album-image.png +0 -0
- package/screenshot/get-play-all-data.png +0 -0
- package/screenshot/get-song-album-id.png +0 -0
- package/screenshot/get-song-id.png +0 -0
- package/screenshot/get-song-image.png +0 -0
- package/screenshot/getAlbumInfo.png +0 -0
- package/screenshot/getComments-id.png +0 -0
- package/screenshot/getComments-param.png +0 -0
- package/screenshot/getComments.png +0 -0
- package/screenshot/getDigitalAlbumLists.png +0 -0
- package/screenshot/getLyric-parse.png +0 -0
- package/screenshot/getLyric.png +0 -0
- package/screenshot/getMusicPlay.png +0 -0
- package/screenshot/getMv.png +0 -0
- package/screenshot/getMvByTag.png +0 -0
- package/screenshot/getMvPlay.png +0 -0
- package/screenshot/getNewDisks.png +0 -0
- package/screenshot/getRadioLists.png +0 -0
- package/screenshot/getRanks.png +0 -0
- package/screenshot/getRecommend.png +0 -0
- package/screenshot/getSearchByKey.png +0 -0
- package/screenshot/getSimilarSinger.png +0 -0
- package/screenshot/getSingerAlbum.png +0 -0
- package/screenshot/getSingerDesc.png +0 -0
- package/screenshot/getSingerHotsong.png +0 -0
- package/screenshot/getSingerList.png +0 -0
- package/screenshot/getSingerMv-default.png +0 -0
- package/screenshot/getSingerMv-listen.png +0 -0
- package/screenshot/getSingerMv-time.png +0 -0
- package/screenshot/getSingerStarNum.png +0 -0
- package/screenshot/getSmartbox.png +0 -0
- package/screenshot/getSongInfo.png +0 -0
- package/screenshot/getSongListCategories.png +0 -0
- package/screenshot/getSongListDetail.png +0 -0
- package/screenshot/getSongLists-params.png +0 -0
- package/screenshot/getSongLists.png +0 -0
- package/screenshot/getTicketInfo.png +0 -0
- package/screenshot/getTopLists.png +0 -0
- package/screenshot/gethotkey.png +0 -0
- package/screenshot/just-get-play-url.png +0 -0
- package/screenshot/musicPlay.png +0 -0
- package/screenshot/new-feature-error-tips.png +0 -0
- package/screenshot/normalize-cookie.png +0 -0
- package/screenshot/qq-music-v0.png +0 -0
- package/screenshot/qq-music.png +0 -0
- package/screenshot/song-image.png +0 -0
- package/screenshot/song-quality-128.png +0 -0
- package/screenshot/song-quality-m4a.png +0 -0
- package/scripts/build-images.js +0 -36
- package/scripts/commit-push.sh +0 -103
- package/tests/integration/api/api.test.ts +0 -852
- package/tests/integration/middleware/cors.test.ts +0 -41
- package/tests/setup/jest.setup.ts +0 -15
- package/tests/setup/testUtils.ts +0 -35
- package/tests/unit/util/request.test.ts +0 -177
- package/tsconfig.json +0 -20
- package/tsconfig.test.json +0 -8
- package/types/api.ts +0 -105
- package/types/global.d.ts +0 -26
- package/types/index.d.ts +0 -97
- package/util/apiResponse.ts +0 -97
- package/util/colors.ts +0 -31
- package/util/cookie.ts +0 -40
- package/util/loginUtils.ts +0 -26
- package/util/lyricParse.ts +0 -86
- package/util/request.ts +0 -141
- package/vercel.json +0 -15
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const module_1 = require("../../module");
|
|
4
|
+
const controller = async (ctx, next) => {
|
|
5
|
+
const { ptqrtoken, qrsig } = ctx.query.ptqrtoken ? ctx.query : ctx.request.body || {};
|
|
6
|
+
const params = { ptqrtoken, qrsig };
|
|
7
|
+
const props = {
|
|
8
|
+
method: 'get',
|
|
9
|
+
option: {},
|
|
10
|
+
params
|
|
11
|
+
};
|
|
12
|
+
const { status, body } = await (0, module_1.checkQQLoginQr)(props);
|
|
13
|
+
ctx.status = status || 500;
|
|
14
|
+
ctx.body = body;
|
|
15
|
+
};
|
|
16
|
+
exports.default = controller;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/*
|
|
4
|
+
* @Author: Rainy [https://github.com/rain120]
|
|
5
|
+
* @Date: 2021-01-23 15:41:41
|
|
6
|
+
* @LastEditors: Rainy
|
|
7
|
+
* @LastEditTime: 2021-06-19 22:22:31
|
|
8
|
+
*/
|
|
9
|
+
exports.default = {
|
|
10
|
+
get: async (ctx, next) => {
|
|
11
|
+
ctx.status = 200;
|
|
12
|
+
ctx.body = {
|
|
13
|
+
data: {
|
|
14
|
+
code: 200,
|
|
15
|
+
cookie: global.userInfo.cookie,
|
|
16
|
+
cookieList: global.userInfo.cookieList,
|
|
17
|
+
cookieObject: global.userInfo.cookieObject
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
await next();
|
|
21
|
+
},
|
|
22
|
+
set: async (ctx, next) => {
|
|
23
|
+
ctx.request.cookies = global.userInfo.cookie;
|
|
24
|
+
ctx.request.header['Access-Control-Allow-Origin'] = 'https://y.qq.com';
|
|
25
|
+
ctx.request.header['Access-Control-Allow-Methods'] = 'GET,PUT,POST,DELETE';
|
|
26
|
+
ctx.request.header['Access-Control-Allow-Headers'] = 'Content-Type';
|
|
27
|
+
ctx.request.header['Access-Control-Allow-Credentials'] = true;
|
|
28
|
+
ctx.body = {
|
|
29
|
+
data: {
|
|
30
|
+
code: 200,
|
|
31
|
+
message: '操作成功'
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
await next();
|
|
35
|
+
}
|
|
36
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const module_1 = require("../../module");
|
|
4
|
+
const util_1 = require("../util");
|
|
5
|
+
const apiResponse_1 = require("../../util/apiResponse");
|
|
6
|
+
const getAlbumInfoController = (0, util_1.withErrorHandler)(async (ctx) => {
|
|
7
|
+
const { albummid } = ctx.query;
|
|
8
|
+
const props = {
|
|
9
|
+
method: 'get',
|
|
10
|
+
params: {
|
|
11
|
+
albummid
|
|
12
|
+
},
|
|
13
|
+
option: {}
|
|
14
|
+
};
|
|
15
|
+
if (!albummid) {
|
|
16
|
+
(0, util_1.setApiResponse)(ctx, (0, apiResponse_1.errorResponse)('no albummid', 400));
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const result = await (0, module_1.getAlbumInfo)(props);
|
|
20
|
+
(0, util_1.setApiResponse)(ctx, result);
|
|
21
|
+
});
|
|
22
|
+
exports.default = getAlbumInfoController;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const module_1 = require("../../module");
|
|
4
|
+
const util_1 = require("../util");
|
|
5
|
+
const apiResponse_1 = require("../../util/apiResponse");
|
|
6
|
+
const getCommentsController = (0, util_1.withErrorHandler)(async (ctx) => {
|
|
7
|
+
const { id, pagesize = 25, pagenum = 0, cid = 205360772, cmd = 8, reqtype = 2, biztype = 1, rootcommentid = !pagenum && '' } = ctx.query;
|
|
8
|
+
const checkrootcommentid = !pagenum ? true : !!rootcommentid;
|
|
9
|
+
const params = {
|
|
10
|
+
cid,
|
|
11
|
+
reqtype,
|
|
12
|
+
biztype,
|
|
13
|
+
topid: id,
|
|
14
|
+
cmd,
|
|
15
|
+
pagenum,
|
|
16
|
+
pagesize,
|
|
17
|
+
lasthotcommentid: rootcommentid
|
|
18
|
+
};
|
|
19
|
+
const props = {
|
|
20
|
+
method: 'get',
|
|
21
|
+
params,
|
|
22
|
+
option: {}
|
|
23
|
+
};
|
|
24
|
+
if (!id || !checkrootcommentid) {
|
|
25
|
+
(0, util_1.setApiResponse)(ctx, (0, apiResponse_1.errorResponse)('Don\'t have id or rootcommentid', 400));
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const result = await (0, module_1.getComments)(props);
|
|
29
|
+
(0, util_1.setApiResponse)(ctx, result);
|
|
30
|
+
});
|
|
31
|
+
exports.default = getCommentsController;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getDailyRecommendController = getDailyRecommendController;
|
|
7
|
+
exports.getPrivateFMController = getPrivateFMController;
|
|
8
|
+
exports.getNewSongsController = getNewSongsController;
|
|
9
|
+
const getDailyRecommend_1 = __importDefault(require("../../module/apis/recommend/getDailyRecommend"));
|
|
10
|
+
const cookieResolver_1 = require("../../util/cookieResolver");
|
|
11
|
+
async function getDailyRecommendController(ctx) {
|
|
12
|
+
const { cookie } = (0, cookieResolver_1.resolveRequestCookie)(ctx);
|
|
13
|
+
const result = await getDailyRecommend_1.default.getDailyRecommend(cookie);
|
|
14
|
+
ctx.status = result.status;
|
|
15
|
+
ctx.body = result.body;
|
|
16
|
+
}
|
|
17
|
+
async function getPrivateFMController(ctx) {
|
|
18
|
+
const { cookie } = (0, cookieResolver_1.resolveRequestCookie)(ctx);
|
|
19
|
+
const result = await getDailyRecommend_1.default.getPrivateFM(cookie);
|
|
20
|
+
ctx.status = result.status;
|
|
21
|
+
ctx.body = result.body;
|
|
22
|
+
}
|
|
23
|
+
async function getNewSongsController(ctx) {
|
|
24
|
+
const { areaId = '5', limit = '20' } = ctx.query;
|
|
25
|
+
const result = await getDailyRecommend_1.default.getNewSongs(Number(areaId), Number(limit));
|
|
26
|
+
ctx.status = result.status;
|
|
27
|
+
ctx.body = result.body;
|
|
28
|
+
}
|
|
29
|
+
exports.default = {
|
|
30
|
+
getDailyRecommend: getDailyRecommendController,
|
|
31
|
+
getPrivateFM: getPrivateFMController,
|
|
32
|
+
getNewSongs: getNewSongsController
|
|
33
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const module_1 = require("../../module");
|
|
4
|
+
const controller = async (ctx, next) => {
|
|
5
|
+
const props = {
|
|
6
|
+
method: 'get',
|
|
7
|
+
params: {},
|
|
8
|
+
option: {}
|
|
9
|
+
};
|
|
10
|
+
const { status, body } = await (0, module_1.getDigitalAlbumLists)(props);
|
|
11
|
+
Object.assign(ctx, {
|
|
12
|
+
status,
|
|
13
|
+
body
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
exports.default = controller;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const module_1 = require("../../module");
|
|
4
|
+
exports.default = async (ctx, next) => {
|
|
5
|
+
const props = {
|
|
6
|
+
method: 'get',
|
|
7
|
+
params: {},
|
|
8
|
+
option: {}
|
|
9
|
+
};
|
|
10
|
+
const result = await (0, module_1.downloadQQMusic)(props);
|
|
11
|
+
const { status, body } = result;
|
|
12
|
+
Object.assign(ctx, {
|
|
13
|
+
status,
|
|
14
|
+
body
|
|
15
|
+
});
|
|
16
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const module_1 = require("../../module");
|
|
4
|
+
const util_1 = require("../util");
|
|
5
|
+
const getHotkeyController = (0, util_1.withErrorHandler)(async (ctx) => {
|
|
6
|
+
const props = {
|
|
7
|
+
method: 'get',
|
|
8
|
+
params: {},
|
|
9
|
+
option: {}
|
|
10
|
+
};
|
|
11
|
+
if (process.env.DEBUG === 'true') {
|
|
12
|
+
console.log('[getHotkey] controller props:', props);
|
|
13
|
+
}
|
|
14
|
+
const result = await (0, module_1.getHotKey)(props);
|
|
15
|
+
if (process.env.DEBUG === 'true') {
|
|
16
|
+
console.log('[getHotkey] controller response status:', result.status);
|
|
17
|
+
}
|
|
18
|
+
(0, util_1.setApiResponse)(ctx, result);
|
|
19
|
+
});
|
|
20
|
+
exports.default = getHotkeyController;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const controller = async (ctx, next) => {
|
|
4
|
+
const { id, size = '300x300', maxAge = 2592000 } = ctx.query;
|
|
5
|
+
if (!id) {
|
|
6
|
+
ctx.status = 400;
|
|
7
|
+
ctx.body = {
|
|
8
|
+
response: 'no id~~'
|
|
9
|
+
};
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
const body = {
|
|
13
|
+
response: {
|
|
14
|
+
code: 0,
|
|
15
|
+
data: {
|
|
16
|
+
imageUrl: `https://y.gtimg.cn/music/photo_new/T002R${size}M000${id}.jpg?max_age=${maxAge}`
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
Object.assign(ctx, {
|
|
21
|
+
status: 200,
|
|
22
|
+
body
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
exports.default = controller;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const module_1 = require("../../module");
|
|
4
|
+
const controller = async (ctx, next) => {
|
|
5
|
+
const songmid = Array.isArray(ctx.query.songmid) ? ctx.query.songmid[0] : ctx.query.songmid;
|
|
6
|
+
const rawIsFormat = Array.isArray(ctx.query.isFormat) ? ctx.query.isFormat[0] : ctx.query.isFormat;
|
|
7
|
+
const props = {
|
|
8
|
+
method: 'get',
|
|
9
|
+
params: {
|
|
10
|
+
songmid
|
|
11
|
+
},
|
|
12
|
+
option: {},
|
|
13
|
+
isFormat: rawIsFormat
|
|
14
|
+
};
|
|
15
|
+
if (songmid) {
|
|
16
|
+
const { status, body } = await (0, module_1.getLyric)(props);
|
|
17
|
+
Object.assign(ctx, {
|
|
18
|
+
status,
|
|
19
|
+
body
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
ctx.status = 400;
|
|
24
|
+
ctx.body = {
|
|
25
|
+
response: 'no songmid'
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
exports.default = controller;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const module_1 = require("../../module");
|
|
4
|
+
const cookieResolver_1 = require("../../util/cookieResolver");
|
|
5
|
+
const controller = async (ctx, next) => {
|
|
6
|
+
const songmid = ctx.query.songmid ?? ctx.params.songmid;
|
|
7
|
+
const resType = Array.isArray(ctx.query.resType) ? ctx.query.resType[0] : ctx.query.resType;
|
|
8
|
+
const mediaId = Array.isArray(ctx.query.mediaId) ? ctx.query.mediaId[0] : ctx.query.mediaId;
|
|
9
|
+
const quality = Array.isArray(ctx.query.quality) ? ctx.query.quality[0] : ctx.query.quality;
|
|
10
|
+
const { cookie: effectiveCookie } = (0, cookieResolver_1.resolveRequestCookie)(ctx);
|
|
11
|
+
const headers = {};
|
|
12
|
+
if (effectiveCookie) {
|
|
13
|
+
headers.Cookie = effectiveCookie;
|
|
14
|
+
}
|
|
15
|
+
const props = {
|
|
16
|
+
method: 'get',
|
|
17
|
+
params: {
|
|
18
|
+
songmid,
|
|
19
|
+
resType,
|
|
20
|
+
mediaId,
|
|
21
|
+
quality
|
|
22
|
+
},
|
|
23
|
+
option: {
|
|
24
|
+
headers
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
const { status, body } = await (0, module_1.getMusicPlay)(props);
|
|
28
|
+
Object.assign(ctx, {
|
|
29
|
+
status,
|
|
30
|
+
body
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
exports.default = controller;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const module_1 = require("../../module");
|
|
4
|
+
const util_1 = require("../util");
|
|
5
|
+
const apiResponse_1 = require("../../util/apiResponse");
|
|
6
|
+
const getMvController = (0, util_1.withErrorHandler)(async (ctx) => {
|
|
7
|
+
const { area_id = 15, version_id = 7, limit = 20, page = 0 } = ctx.query;
|
|
8
|
+
const start = (+page ? +page - 1 : 0) * +limit;
|
|
9
|
+
const data = {
|
|
10
|
+
comm: {
|
|
11
|
+
ct: 24
|
|
12
|
+
},
|
|
13
|
+
mv_tag: {
|
|
14
|
+
module: 'MvService.MvInfoProServer',
|
|
15
|
+
method: 'GetAllocTag',
|
|
16
|
+
param: {}
|
|
17
|
+
},
|
|
18
|
+
mv_list: {
|
|
19
|
+
module: 'MvService.MvInfoProServer',
|
|
20
|
+
method: 'GetAllocMvInfo',
|
|
21
|
+
param: {
|
|
22
|
+
start,
|
|
23
|
+
limit: +limit,
|
|
24
|
+
version_id,
|
|
25
|
+
area_id,
|
|
26
|
+
order: 1
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
const params = {
|
|
31
|
+
format: 'json',
|
|
32
|
+
data: JSON.stringify(data)
|
|
33
|
+
};
|
|
34
|
+
const props = {
|
|
35
|
+
method: 'get',
|
|
36
|
+
params,
|
|
37
|
+
option: {}
|
|
38
|
+
};
|
|
39
|
+
if (!version_id || !area_id) {
|
|
40
|
+
(0, util_1.setApiResponse)(ctx, {
|
|
41
|
+
status: 400,
|
|
42
|
+
body: {
|
|
43
|
+
response: 'version_id or area_id is null'
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const response = await (0, module_1.UCommon)(props);
|
|
49
|
+
(0, util_1.setApiResponse)(ctx, (0, apiResponse_1.customResponse)({ response: response.data }, 200));
|
|
50
|
+
});
|
|
51
|
+
exports.default = getMvController;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const module_1 = require("../../module");
|
|
4
|
+
const controller = async (ctx, next) => {
|
|
5
|
+
const props = {
|
|
6
|
+
method: 'get',
|
|
7
|
+
params: {},
|
|
8
|
+
option: {}
|
|
9
|
+
};
|
|
10
|
+
const { status, body } = await (0, module_1.getMvByTag)(props);
|
|
11
|
+
Object.assign(ctx, {
|
|
12
|
+
status,
|
|
13
|
+
body
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
exports.default = controller;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const module_1 = require("../../module");
|
|
4
|
+
const util_1 = require("../util");
|
|
5
|
+
const apiResponse_1 = require("../../util/apiResponse");
|
|
6
|
+
const getMvPlayController = (0, util_1.withErrorHandler)(async (ctx) => {
|
|
7
|
+
const { vid } = ctx.query;
|
|
8
|
+
if (!vid) {
|
|
9
|
+
(0, util_1.setApiResponse)(ctx, {
|
|
10
|
+
status: 400,
|
|
11
|
+
body: {
|
|
12
|
+
response: 'vid is null'
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
const data = {
|
|
18
|
+
comm: {
|
|
19
|
+
ct: 24,
|
|
20
|
+
cv: 4747474
|
|
21
|
+
},
|
|
22
|
+
getMVUrl: {
|
|
23
|
+
module: 'gosrf.Stream.MvUrlProxy',
|
|
24
|
+
method: 'GetMvUrls',
|
|
25
|
+
param: {
|
|
26
|
+
vids: [vid],
|
|
27
|
+
request_typet: 10001
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
mvinfo: {
|
|
31
|
+
module: 'video.VideoDataServer',
|
|
32
|
+
method: 'get_video_info_batch',
|
|
33
|
+
param: {
|
|
34
|
+
vidlist: [vid],
|
|
35
|
+
required: [
|
|
36
|
+
'vid', 'type', 'sid', 'cover_pic', 'duration', 'singers',
|
|
37
|
+
'video_switch', 'msg', 'name', 'desc', 'playcnt', 'pubdate',
|
|
38
|
+
'isfav', 'gmid'
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
other: {
|
|
43
|
+
module: 'video.VideoLogicServer',
|
|
44
|
+
method: 'rec_video_byvid',
|
|
45
|
+
param: {
|
|
46
|
+
vid,
|
|
47
|
+
required: [
|
|
48
|
+
'vid', 'type', 'sid', 'cover_pic', 'duration', 'singers',
|
|
49
|
+
'video_switch', 'msg', 'name', 'desc', 'playcnt', 'pubdate',
|
|
50
|
+
'isfav', 'gmid', 'uploader_headurl', 'uploader_nick',
|
|
51
|
+
'uploader_encuin', 'uploader_uin', 'uploader_hasfollow',
|
|
52
|
+
'uploader_follower_num'
|
|
53
|
+
],
|
|
54
|
+
support: 1
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
const params = {
|
|
59
|
+
format: 'json',
|
|
60
|
+
data: JSON.stringify(data)
|
|
61
|
+
};
|
|
62
|
+
const props = {
|
|
63
|
+
method: 'get',
|
|
64
|
+
params,
|
|
65
|
+
option: {}
|
|
66
|
+
};
|
|
67
|
+
const response = await (0, module_1.UCommon)(props);
|
|
68
|
+
const mvurls = response.data?.getMVUrl?.data;
|
|
69
|
+
if (!mvurls || typeof mvurls !== 'object' || Object.keys(mvurls).length === 0) {
|
|
70
|
+
(0, util_1.setApiResponse)(ctx, {
|
|
71
|
+
status: 502,
|
|
72
|
+
body: {
|
|
73
|
+
response: {
|
|
74
|
+
data: null,
|
|
75
|
+
error: 'Failed to get MV URL data'
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
const mvurlskey = Object.keys(mvurls)[0];
|
|
82
|
+
const mp4_urls = mvurls[mvurlskey]?.mp4?.map((item) => item.freeflow_url) || [];
|
|
83
|
+
const hls_urls = mvurls[mvurlskey]?.hls?.map((item) => item.freeflow_url) || [];
|
|
84
|
+
const urls = [...mp4_urls, ...hls_urls];
|
|
85
|
+
let play_urls = [];
|
|
86
|
+
const playLists = {
|
|
87
|
+
f10: [],
|
|
88
|
+
f20: [],
|
|
89
|
+
f30: [],
|
|
90
|
+
f40: []
|
|
91
|
+
};
|
|
92
|
+
if (urls.length) {
|
|
93
|
+
urls.forEach((url) => {
|
|
94
|
+
play_urls = [...play_urls, ...url];
|
|
95
|
+
});
|
|
96
|
+
playLists.f10 = play_urls.filter((item) => /\.f10\.mp4/.test(item));
|
|
97
|
+
playLists.f20 = play_urls.filter((item) => /\.f20\.mp4/.test(item));
|
|
98
|
+
playLists.f30 = play_urls.filter((item) => /\.f30\.mp4/.test(item));
|
|
99
|
+
playLists.f40 = play_urls.filter((item) => /\.f40\.mp4/.test(item));
|
|
100
|
+
}
|
|
101
|
+
response.data.playLists = playLists;
|
|
102
|
+
(0, util_1.setApiResponse)(ctx, (0, apiResponse_1.customResponse)({ response: response.data }, 200));
|
|
103
|
+
});
|
|
104
|
+
exports.default = getMvPlayController;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const module_1 = require("../../module");
|
|
4
|
+
const controller = async (ctx, next) => {
|
|
5
|
+
const page = +ctx.query.page || 1;
|
|
6
|
+
const num = +ctx.query.limit || 20;
|
|
7
|
+
const start = (page - 1) * num;
|
|
8
|
+
const data = {
|
|
9
|
+
new_album: {
|
|
10
|
+
module: 'newalbum.NewAlbumServer',
|
|
11
|
+
method: 'get_new_album_info',
|
|
12
|
+
param: {
|
|
13
|
+
area: 1,
|
|
14
|
+
start,
|
|
15
|
+
num
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
comm: {
|
|
19
|
+
ct: 24,
|
|
20
|
+
cv: 0
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
if (!start) {
|
|
24
|
+
data.new_album_tag = {
|
|
25
|
+
module: 'newalbum.NewAlbumServer',
|
|
26
|
+
method: 'get_new_album_area',
|
|
27
|
+
param: {}
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
const params = Object.assign({
|
|
31
|
+
format: 'json',
|
|
32
|
+
data: JSON.stringify(data)
|
|
33
|
+
});
|
|
34
|
+
const props = {
|
|
35
|
+
method: 'get',
|
|
36
|
+
params,
|
|
37
|
+
option: {}
|
|
38
|
+
};
|
|
39
|
+
await (0, module_1.UCommon)(props)
|
|
40
|
+
.then(res => {
|
|
41
|
+
const response = res.data;
|
|
42
|
+
ctx.status = 200;
|
|
43
|
+
ctx.body = {
|
|
44
|
+
status: 200,
|
|
45
|
+
response
|
|
46
|
+
};
|
|
47
|
+
})
|
|
48
|
+
.catch(error => {
|
|
49
|
+
console.log('error', error);
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
exports.default = controller;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getPersonalRecommendController = getPersonalRecommendController;
|
|
7
|
+
exports.getSimilarSongsController = getSimilarSongsController;
|
|
8
|
+
const getPersonalRecommend_1 = __importDefault(require("../../module/apis/recommend/getPersonalRecommend"));
|
|
9
|
+
const cookieResolver_1 = require("../../util/cookieResolver");
|
|
10
|
+
const apiResponse_1 = require("../../util/apiResponse");
|
|
11
|
+
async function getPersonalRecommendController(ctx) {
|
|
12
|
+
const { type = '1' } = ctx.query;
|
|
13
|
+
const rawType = Array.isArray(type) ? type[0] : type;
|
|
14
|
+
const { cookie } = (0, cookieResolver_1.resolveRequestCookie)(ctx);
|
|
15
|
+
const result = await getPersonalRecommend_1.default.getPersonalRecommend(Number(rawType), cookie);
|
|
16
|
+
ctx.status = result.status;
|
|
17
|
+
ctx.body = result.body;
|
|
18
|
+
}
|
|
19
|
+
async function getSimilarSongsController(ctx) {
|
|
20
|
+
const { songmid } = ctx.query;
|
|
21
|
+
if (!songmid) {
|
|
22
|
+
const result = (0, apiResponse_1.errorResponse)('缺少参数 songmid', 400);
|
|
23
|
+
ctx.status = result.status;
|
|
24
|
+
ctx.body = result.body;
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const validSongmid = Array.isArray(songmid) ? songmid[0] : songmid;
|
|
28
|
+
if (!validSongmid || String(validSongmid).trim() === '') {
|
|
29
|
+
const result = (0, apiResponse_1.errorResponse)('参数 songmid 不能为空', 400);
|
|
30
|
+
ctx.status = result.status;
|
|
31
|
+
ctx.body = result.body;
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const { cookie } = (0, cookieResolver_1.resolveRequestCookie)(ctx);
|
|
35
|
+
const result = await getPersonalRecommend_1.default.getSimilarSongs(String(validSongmid), cookie);
|
|
36
|
+
ctx.status = result.status;
|
|
37
|
+
ctx.body = result.body;
|
|
38
|
+
}
|
|
39
|
+
exports.default = {
|
|
40
|
+
getPersonalRecommend: getPersonalRecommendController,
|
|
41
|
+
getSimilarSongs: getSimilarSongsController
|
|
42
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getSingerListByAreaController = exports.getHotCommentsController = exports.getPlaylistsByTagController = exports.getPlaylistTagsController = void 0;
|
|
7
|
+
const getPlaylistTags_1 = __importDefault(require("../../module/apis/extend/getPlaylistTags"));
|
|
8
|
+
const util_1 = require("../util");
|
|
9
|
+
const apiResponse_1 = require("../../util/apiResponse");
|
|
10
|
+
/**
|
|
11
|
+
* 获取歌单标签列表
|
|
12
|
+
*/
|
|
13
|
+
const getPlaylistTagsController = (0, util_1.withErrorHandler)(async (ctx) => {
|
|
14
|
+
const result = await getPlaylistTags_1.default.getPlaylistTags();
|
|
15
|
+
(0, util_1.setApiResponse)(ctx, result);
|
|
16
|
+
});
|
|
17
|
+
exports.getPlaylistTagsController = getPlaylistTagsController;
|
|
18
|
+
/**
|
|
19
|
+
* 根据标签获取歌单列表
|
|
20
|
+
*/
|
|
21
|
+
const getPlaylistsByTagController = (0, util_1.withErrorHandler)(async (ctx) => {
|
|
22
|
+
const { tagId = '1', page = '0', num = '20' } = ctx.query;
|
|
23
|
+
const result = await getPlaylistTags_1.default.getPlaylistsByTag(Number(tagId), Number(page), Number(num));
|
|
24
|
+
(0, util_1.setApiResponse)(ctx, result);
|
|
25
|
+
});
|
|
26
|
+
exports.getPlaylistsByTagController = getPlaylistsByTagController;
|
|
27
|
+
/**
|
|
28
|
+
* 获取热门评论
|
|
29
|
+
*/
|
|
30
|
+
const getHotCommentsController = (0, util_1.withErrorHandler)(async (ctx) => {
|
|
31
|
+
const { id, type = '1', page = '0', pagesize = '20' } = ctx.query;
|
|
32
|
+
if (!id) {
|
|
33
|
+
(0, util_1.setApiResponse)(ctx, (0, apiResponse_1.errorResponse)('缺少参数 id(资源 ID)', 400));
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const result = await getPlaylistTags_1.default.getHotComments(id, Number(type), Number(page), Number(pagesize));
|
|
37
|
+
(0, util_1.setApiResponse)(ctx, result);
|
|
38
|
+
});
|
|
39
|
+
exports.getHotCommentsController = getHotCommentsController;
|
|
40
|
+
/**
|
|
41
|
+
* 获取歌手分类列表
|
|
42
|
+
*/
|
|
43
|
+
const getSingerListByAreaController = (0, util_1.withErrorHandler)(async (ctx) => {
|
|
44
|
+
const { area = '-1', sex = '-1', genre = '-1', page = '1', pagesize = '80' } = ctx.query;
|
|
45
|
+
const result = await getPlaylistTags_1.default.getSingerListByArea(Number(area), Number(sex), Number(genre), Number(page), Number(pagesize));
|
|
46
|
+
(0, util_1.setApiResponse)(ctx, result);
|
|
47
|
+
});
|
|
48
|
+
exports.getSingerListByAreaController = getSingerListByAreaController;
|
|
49
|
+
exports.default = {
|
|
50
|
+
getPlaylistTags: getPlaylistTagsController,
|
|
51
|
+
getPlaylistsByTag: getPlaylistsByTagController,
|
|
52
|
+
getHotComments: getHotCommentsController,
|
|
53
|
+
getSingerListByArea: getSingerListByAreaController
|
|
54
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const module_1 = require("../../module");
|
|
4
|
+
const controller = async (ctx, next) => {
|
|
5
|
+
const props = {
|
|
6
|
+
method: 'get'
|
|
7
|
+
};
|
|
8
|
+
const { status, body } = await (0, module_1.getQQLoginQr)(props);
|
|
9
|
+
Object.assign(ctx, {
|
|
10
|
+
status,
|
|
11
|
+
body
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
exports.default = controller;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const module_1 = require("../../module");
|
|
4
|
+
const controller = async (ctx, next) => {
|
|
5
|
+
const props = {
|
|
6
|
+
method: 'get',
|
|
7
|
+
params: {},
|
|
8
|
+
option: {}
|
|
9
|
+
};
|
|
10
|
+
const { status, body } = await (0, module_1.getRadioLists)(props);
|
|
11
|
+
Object.assign(ctx, {
|
|
12
|
+
status,
|
|
13
|
+
body
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
exports.default = controller;
|