@sansenjian/qq-music-api 2.2.7 → 2.2.10
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 +23 -1
- package/README.md +2 -0
- package/dist/api/index.js +9 -0
- package/dist/app.js +30 -45
- package/dist/config/service-config.js +37 -0
- package/dist/index.js +13 -1
- package/dist/jest.config.js +14 -2
- package/dist/koaApp.js +45 -0
- package/dist/middlewares/fallback-middleware.js +29 -0
- package/dist/module/apis/music/getLyric.js +220 -16
- package/dist/module/apis/music/getMusicPlay.js +187 -0
- package/dist/module/apis/u_common.js +8 -2
- package/dist/module/apis/user/getUserPlaylists.js +5 -5
- package/dist/module/index.js +3 -1
- package/dist/package.json +5 -2
- package/dist/routers/context/batchGetSongInfo.js +11 -16
- package/dist/routers/context/batchGetSongLists.js +18 -20
- package/dist/routers/context/getAlbumInfo.js +10 -17
- package/dist/routers/context/getComments.js +12 -19
- package/dist/routers/context/getDailyRecommend.js +5 -17
- package/dist/routers/context/getHotkey.js +7 -8
- package/dist/routers/context/getLyric.js +12 -2
- package/dist/routers/context/getMusicPlay.js +23 -81
- package/dist/routers/context/getMv.js +16 -22
- package/dist/routers/context/getMvPlay.js +48 -49
- package/dist/routers/context/getPersonalRecommend.js +13 -25
- package/dist/routers/context/getPlaylistTags.js +20 -26
- package/dist/routers/context/getRanks.js +9 -16
- package/dist/routers/context/getSingerAlbum.js +16 -22
- package/dist/routers/context/getSingerHotsong.js +16 -22
- package/dist/routers/context/getSingerList.js +9 -21
- package/dist/routers/context/getSongInfo.js +9 -16
- package/dist/routers/context/getSongListCategories.js +6 -7
- package/dist/routers/context/getSongListDetail.js +6 -8
- package/dist/routers/context/getUserAvatar.js +20 -33
- package/dist/routers/context/getUserPlaylists.js +6 -3
- package/dist/routers/context/index.js +94 -103
- package/dist/routers/util.js +31 -0
- package/dist/scripts/run-tests-with-flags.js +139 -0
- package/dist/util/cookie.js +15 -7
- package/dist/util/cookieResolver.js +66 -0
- package/dist/util/request.js +15 -6
- package/docs-dist/404.html +2 -2
- package/docs-dist/CHANGELOG-ARCHITECTURE.html +6 -6
- package/docs-dist/COOKIE_CONFIG_GUIDE.html +6 -6
- package/docs-dist/FALLBACK_MODE_GUIDE.html +101 -0
- package/docs-dist/README.html +6 -6
- package/docs-dist/TEST_USER_PLAYLISTS.html +6 -6
- package/docs-dist/USER_AVATAR_GUIDE.html +6 -6
- package/docs-dist/api/comments.html +6 -6
- package/docs-dist/api/index.html +6 -6
- package/docs-dist/api/music.html +6 -6
- package/docs-dist/api/other.html +6 -6
- package/docs-dist/api/playlist.html +6 -6
- package/docs-dist/api/rank.html +6 -6
- package/docs-dist/api/search.html +6 -6
- package/docs-dist/api/singer.html +6 -6
- package/docs-dist/api/user.html +6 -6
- package/docs-dist/assets/{CHANGELOG-ARCHITECTURE.md.BOe0ZtyR.js → CHANGELOG-ARCHITECTURE.md.DV9Xr7ve.js} +1 -1
- package/docs-dist/assets/{CHANGELOG-ARCHITECTURE.md.BOe0ZtyR.lean.js → CHANGELOG-ARCHITECTURE.md.DV9Xr7ve.lean.js} +1 -1
- package/docs-dist/assets/{COOKIE_CONFIG_GUIDE.md.D68AwXR2.js → COOKIE_CONFIG_GUIDE.md.B2-aTdcH.js} +1 -1
- package/docs-dist/assets/{COOKIE_CONFIG_GUIDE.md.D68AwXR2.lean.js → COOKIE_CONFIG_GUIDE.md.B2-aTdcH.lean.js} +1 -1
- package/docs-dist/assets/FALLBACK_MODE_GUIDE.md.0wqXqYxw.js +75 -0
- package/docs-dist/assets/FALLBACK_MODE_GUIDE.md.0wqXqYxw.lean.js +1 -0
- package/docs-dist/assets/{README.md.ZJQGJ1Gb.js → README.md.DFCMeLFa.js} +1 -1
- package/docs-dist/assets/{README.md.ZJQGJ1Gb.lean.js → README.md.DFCMeLFa.lean.js} +1 -1
- package/docs-dist/assets/{TEST_USER_PLAYLISTS.md.C02575X2.js → TEST_USER_PLAYLISTS.md.Bj0AVpHw.js} +1 -1
- package/docs-dist/assets/{TEST_USER_PLAYLISTS.md.C02575X2.lean.js → TEST_USER_PLAYLISTS.md.Bj0AVpHw.lean.js} +1 -1
- package/docs-dist/assets/{USER_AVATAR_GUIDE.md.BOqjn5Cm.js → USER_AVATAR_GUIDE.md.CGPI9GUj.js} +1 -1
- package/docs-dist/assets/{USER_AVATAR_GUIDE.md.BOqjn5Cm.lean.js → USER_AVATAR_GUIDE.md.CGPI9GUj.lean.js} +1 -1
- package/docs-dist/assets/{api_comments.md.DADvndEA.js → api_comments.md.CATvWhrg.js} +1 -1
- package/docs-dist/assets/{api_comments.md.DADvndEA.lean.js → api_comments.md.CATvWhrg.lean.js} +1 -1
- package/docs-dist/assets/{api_index.md.D5IASxxG.js → api_index.md.Dqx3qXyO.js} +1 -1
- package/docs-dist/assets/{api_index.md.D5IASxxG.lean.js → api_index.md.Dqx3qXyO.lean.js} +1 -1
- package/docs-dist/assets/{api_music.md.BgB8NmZq.js → api_music.md.D20_neZB.js} +1 -1
- package/docs-dist/assets/{api_music.md.BgB8NmZq.lean.js → api_music.md.D20_neZB.lean.js} +1 -1
- package/docs-dist/assets/{api_other.md.BkRWXX2z.js → api_other.md.CXyEsl8R.js} +1 -1
- package/docs-dist/assets/{api_other.md.BkRWXX2z.lean.js → api_other.md.CXyEsl8R.lean.js} +1 -1
- package/docs-dist/assets/{api_playlist.md.Dc0hTrZ4.js → api_playlist.md.CyLdLRR9.js} +1 -1
- package/docs-dist/assets/{api_playlist.md.Dc0hTrZ4.lean.js → api_playlist.md.CyLdLRR9.lean.js} +1 -1
- package/docs-dist/assets/{api_rank.md.DRisCFyT.js → api_rank.md.Z3xyYG_S.js} +1 -1
- package/docs-dist/assets/{api_rank.md.DRisCFyT.lean.js → api_rank.md.Z3xyYG_S.lean.js} +1 -1
- package/docs-dist/assets/{api_search.md.DNnMUZK0.js → api_search.md.D_lbFmYo.js} +1 -1
- package/docs-dist/assets/{api_search.md.DNnMUZK0.lean.js → api_search.md.D_lbFmYo.lean.js} +1 -1
- package/docs-dist/assets/{api_singer.md.DCmuxQkk.js → api_singer.md.BbyYE88D.js} +1 -1
- package/docs-dist/assets/{api_singer.md.DCmuxQkk.lean.js → api_singer.md.BbyYE88D.lean.js} +1 -1
- package/docs-dist/assets/{api_user.md.Cjm9GG3z.js → api_user.md.4WdmTXIB.js} +1 -1
- package/docs-dist/assets/{api_user.md.Cjm9GG3z.lean.js → api_user.md.4WdmTXIB.lean.js} +1 -1
- package/docs-dist/assets/{app.Dx_1wB58.js → app.2f7gcITE.js} +1 -1
- package/docs-dist/assets/chunks/@localSearchIndexroot.D461xa5C.js +1 -0
- package/docs-dist/assets/chunks/{VPLocalSearchBox.DwKWtsdX.js → VPLocalSearchBox.BiPSl83v.js} +1 -1
- package/docs-dist/assets/chunks/framework.aJbMEiY9.js +19 -0
- package/docs-dist/assets/chunks/{theme.pGVgJ9Cx.js → theme.BrMPT0hE.js} +2 -2
- package/docs-dist/assets/{guide_architecture.md.DGtNyuMH.js → guide_architecture.md.D_46khUI.js} +1 -1
- package/docs-dist/assets/{guide_architecture.md.DGtNyuMH.lean.js → guide_architecture.md.D_46khUI.lean.js} +1 -1
- package/docs-dist/assets/{guide_authentication.md.mtI5LfCw.js → guide_authentication.md.nCiAu07w.js} +1 -1
- package/docs-dist/assets/{guide_authentication.md.mtI5LfCw.lean.js → guide_authentication.md.nCiAu07w.lean.js} +1 -1
- package/docs-dist/assets/{guide_index.md.B-0SG46T.js → guide_index.md.gLozHqz5.js} +1 -1
- package/docs-dist/assets/{guide_index.md.B-0SG46T.lean.js → guide_index.md.gLozHqz5.lean.js} +1 -1
- package/docs-dist/assets/{guide_installation.md.k-KpAfxv.js → guide_installation.md.BUDl8zk1.js} +1 -1
- package/docs-dist/assets/guide_installation.md.BUDl8zk1.lean.js +1 -0
- package/docs-dist/assets/{guide_quickstart.md.Bff_KFOD.js → guide_quickstart.md.COQUzUN9.js} +1 -1
- package/docs-dist/assets/guide_quickstart.md.COQUzUN9.lean.js +1 -0
- package/docs-dist/assets/{index.md.xrs-uIyo.js → index.md.DBZfQ2kF.js} +1 -1
- package/docs-dist/assets/{index.md.xrs-uIyo.lean.js → index.md.DBZfQ2kF.lean.js} +1 -1
- package/docs-dist/assets/{reference_response-format.md.DKYTK6uJ.js → reference_response-format.md.yrdeqFUN.js} +1 -1
- package/docs-dist/assets/{reference_response-format.md.DKYTK6uJ.lean.js → reference_response-format.md.yrdeqFUN.lean.js} +1 -1
- package/docs-dist/guide/architecture.html +6 -6
- package/docs-dist/guide/authentication.html +6 -6
- package/docs-dist/guide/index.html +6 -6
- package/docs-dist/guide/installation.html +6 -6
- package/docs-dist/guide/quickstart.html +6 -6
- package/docs-dist/hashmap.json +1 -1
- package/docs-dist/index.html +5 -5
- package/docs-dist/reference/response-format.html +6 -6
- package/docs-dist/version.json +3 -3
- package/package.json +5 -2
- package/docs-dist/assets/chunks/@localSearchIndexroot.CMY5EIwU.js +0 -1
- package/docs-dist/assets/chunks/framework.o40iizuP.js +0 -19
- package/docs-dist/assets/guide_installation.md.k-KpAfxv.lean.js +0 -1
- package/docs-dist/assets/guide_quickstart.md.Bff_KFOD.lean.js +0 -1
|
@@ -1,91 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const module_1 = require("../../module");
|
|
4
|
-
const
|
|
5
|
-
const ALLOWED_QUALITIES = ['m4a', 128, 320, 'ape', 'flac'];
|
|
6
|
-
const DEFAULT_QUALITY = 128;
|
|
7
|
-
const parseQuality = (quality) => {
|
|
8
|
-
const parsed = parseInt(quality) || quality;
|
|
9
|
-
return ALLOWED_QUALITIES.includes(parsed) ? parsed : DEFAULT_QUALITY;
|
|
10
|
-
};
|
|
4
|
+
const cookieResolver_1 = require("../../util/cookieResolver");
|
|
11
5
|
const controller = async (ctx, next) => {
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const {
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const data = {
|
|
29
|
-
req_0: {
|
|
30
|
-
module: 'vkey.GetVkeyServer',
|
|
31
|
-
method: 'CgiGetVkey',
|
|
32
|
-
param: {
|
|
33
|
-
filename: file,
|
|
34
|
-
guid,
|
|
35
|
-
songmid: songmidList,
|
|
36
|
-
songtype: [0],
|
|
37
|
-
uin,
|
|
38
|
-
loginflag: 1,
|
|
39
|
-
platform: '20'
|
|
40
|
-
}
|
|
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
|
|
41
22
|
},
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
uin,
|
|
45
|
-
format: 'json',
|
|
46
|
-
ct: 24,
|
|
47
|
-
cv: 0
|
|
23
|
+
option: {
|
|
24
|
+
headers
|
|
48
25
|
}
|
|
49
26
|
};
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
27
|
+
const { status, body } = await (0, module_1.getMusicPlay)(props);
|
|
28
|
+
Object.assign(ctx, {
|
|
29
|
+
status,
|
|
30
|
+
body
|
|
54
31
|
});
|
|
55
|
-
const props = {
|
|
56
|
-
method: 'get',
|
|
57
|
-
params,
|
|
58
|
-
option: {}
|
|
59
|
-
};
|
|
60
|
-
if (songmid) {
|
|
61
|
-
await (0, module_1.UCommon)(props)
|
|
62
|
-
.then(res => {
|
|
63
|
-
const response = res.data;
|
|
64
|
-
const domain = response?.req_0?.data?.sip?.filter?.((i) => !i.startsWith('http://ws'))?.[0] ||
|
|
65
|
-
response?.req_0?.data?.sip?.[0];
|
|
66
|
-
const playUrl = {};
|
|
67
|
-
(response?.req_0?.data?.midurlinfo || []).forEach((item) => {
|
|
68
|
-
playUrl[item.songmid] = {
|
|
69
|
-
url: item.purl ? `${domain}${item.purl}` : '',
|
|
70
|
-
error: !item.purl ? '暂无播放链接' : undefined
|
|
71
|
-
};
|
|
72
|
-
});
|
|
73
|
-
response.playUrl = playUrl;
|
|
74
|
-
ctx.body = {
|
|
75
|
-
data: justPlayUrl ? { playUrl } : response
|
|
76
|
-
};
|
|
77
|
-
})
|
|
78
|
-
.catch(error => {
|
|
79
|
-
console.log('error', error);
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
ctx.status = 400;
|
|
84
|
-
ctx.body = {
|
|
85
|
-
data: {
|
|
86
|
-
message: 'no songmid'
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
32
|
};
|
|
91
33
|
exports.default = controller;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const module_1 = require("../../module");
|
|
4
|
-
const
|
|
4
|
+
const util_1 = require("../util");
|
|
5
|
+
const apiResponse_1 = require("../../util/apiResponse");
|
|
6
|
+
const getMvController = (0, util_1.withErrorHandler)(async (ctx) => {
|
|
5
7
|
const { area_id = 15, version_id = 7, limit = 20, page = 0 } = ctx.query;
|
|
6
8
|
const start = (+page ? +page - 1 : 0) * +limit;
|
|
7
9
|
const data = {
|
|
@@ -25,33 +27,25 @@ const controller = async (ctx, next) => {
|
|
|
25
27
|
}
|
|
26
28
|
}
|
|
27
29
|
};
|
|
28
|
-
const params =
|
|
30
|
+
const params = {
|
|
29
31
|
format: 'json',
|
|
30
32
|
data: JSON.stringify(data)
|
|
31
|
-
}
|
|
33
|
+
};
|
|
32
34
|
const props = {
|
|
33
35
|
method: 'get',
|
|
34
36
|
params,
|
|
35
37
|
option: {}
|
|
36
38
|
};
|
|
37
|
-
if (version_id
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
response
|
|
44
|
-
};
|
|
45
|
-
})
|
|
46
|
-
.catch(error => {
|
|
47
|
-
console.log('error', error);
|
|
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
|
+
}
|
|
48
45
|
});
|
|
46
|
+
return;
|
|
49
47
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
exports.default = controller;
|
|
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;
|
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const module_1 = require("../../module");
|
|
4
|
-
const
|
|
4
|
+
const util_1 = require("../util");
|
|
5
|
+
const apiResponse_1 = require("../../util/apiResponse");
|
|
6
|
+
const getMvPlayController = (0, util_1.withErrorHandler)(async (ctx) => {
|
|
5
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
|
+
}
|
|
6
17
|
const data = {
|
|
7
18
|
comm: {
|
|
8
19
|
ct: 24,
|
|
@@ -44,62 +55,50 @@ const controller = async (ctx, next) => {
|
|
|
44
55
|
}
|
|
45
56
|
}
|
|
46
57
|
};
|
|
47
|
-
const params =
|
|
58
|
+
const params = {
|
|
48
59
|
format: 'json',
|
|
49
60
|
data: JSON.stringify(data)
|
|
50
|
-
}
|
|
61
|
+
};
|
|
51
62
|
const props = {
|
|
52
63
|
method: 'get',
|
|
53
64
|
params,
|
|
54
65
|
option: {}
|
|
55
66
|
};
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
error: 'Failed to get MV URL data'
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
return;
|
|
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
|
+
}
|
|
70
77
|
}
|
|
71
|
-
const mvurlskey = Object.keys(mvurls)[0];
|
|
72
|
-
const mp4_urls = mvurls[mvurlskey]?.mp4?.map((item) => item.freeflow_url) || [];
|
|
73
|
-
const hls_urls = mvurls[mvurlskey]?.hls?.map((item) => item.freeflow_url) || [];
|
|
74
|
-
const urls = [...mp4_urls, ...hls_urls];
|
|
75
|
-
let play_urls = [];
|
|
76
|
-
let playLists = {};
|
|
77
|
-
if (urls.length) {
|
|
78
|
-
urls.forEach((url) => {
|
|
79
|
-
play_urls = [...play_urls, ...url];
|
|
80
|
-
});
|
|
81
|
-
playLists = {
|
|
82
|
-
f10: play_urls.filter((item) => /\.f10\.mp4/.test(item)),
|
|
83
|
-
f20: play_urls.filter((item) => /\.f20\.mp4/.test(item)),
|
|
84
|
-
f30: play_urls.filter((item) => /\.f30\.mp4/.test(item)),
|
|
85
|
-
f40: play_urls.filter((item) => /\.f40\.mp4/.test(item))
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
response.playLists = playLists;
|
|
89
|
-
ctx.status = 200;
|
|
90
|
-
ctx.body = {
|
|
91
|
-
response
|
|
92
|
-
};
|
|
93
|
-
})
|
|
94
|
-
.catch(error => {
|
|
95
|
-
console.log('error', error);
|
|
96
78
|
});
|
|
79
|
+
return;
|
|
97
80
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
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));
|
|
103
100
|
}
|
|
104
|
-
|
|
105
|
-
|
|
101
|
+
response.data.playLists = playLists;
|
|
102
|
+
(0, util_1.setApiResponse)(ctx, (0, apiResponse_1.customResponse)({ response: response.data }, 200));
|
|
103
|
+
});
|
|
104
|
+
exports.default = getMvPlayController;
|
|
@@ -6,44 +6,32 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.getPersonalRecommendController = getPersonalRecommendController;
|
|
7
7
|
exports.getSimilarSongsController = getSimilarSongsController;
|
|
8
8
|
const getPersonalRecommend_1 = __importDefault(require("../../module/apis/recommend/getPersonalRecommend"));
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
*/
|
|
9
|
+
const cookieResolver_1 = require("../../util/cookieResolver");
|
|
10
|
+
const apiResponse_1 = require("../../util/apiResponse");
|
|
12
11
|
async function getPersonalRecommendController(ctx) {
|
|
13
|
-
const { type = '1'
|
|
14
|
-
// 处理数组类型,取第一个值
|
|
12
|
+
const { type = '1' } = ctx.query;
|
|
15
13
|
const rawType = Array.isArray(type) ? type[0] : type;
|
|
16
|
-
const
|
|
17
|
-
const result = await getPersonalRecommend_1.default.getPersonalRecommend(Number(rawType),
|
|
14
|
+
const { cookie } = (0, cookieResolver_1.resolveRequestCookie)(ctx);
|
|
15
|
+
const result = await getPersonalRecommend_1.default.getPersonalRecommend(Number(rawType), cookie);
|
|
18
16
|
ctx.status = result.status;
|
|
19
17
|
ctx.body = result.body;
|
|
20
18
|
}
|
|
21
|
-
/**
|
|
22
|
-
* 获取相似歌曲
|
|
23
|
-
*/
|
|
24
19
|
async function getSimilarSongsController(ctx) {
|
|
25
|
-
const { songmid
|
|
20
|
+
const { songmid } = ctx.query;
|
|
26
21
|
if (!songmid) {
|
|
27
|
-
|
|
28
|
-
ctx.
|
|
29
|
-
|
|
30
|
-
msg: '缺少参数 songmid',
|
|
31
|
-
data: null
|
|
32
|
-
};
|
|
22
|
+
const result = (0, apiResponse_1.errorResponse)('缺少参数 songmid', 400);
|
|
23
|
+
ctx.status = result.status;
|
|
24
|
+
ctx.body = result.body;
|
|
33
25
|
return;
|
|
34
26
|
}
|
|
35
|
-
// 处理数组类型,取第一个值
|
|
36
27
|
const validSongmid = Array.isArray(songmid) ? songmid[0] : songmid;
|
|
37
|
-
// 校验空字符串
|
|
38
28
|
if (!validSongmid || String(validSongmid).trim() === '') {
|
|
39
|
-
|
|
40
|
-
ctx.
|
|
41
|
-
|
|
42
|
-
msg: '参数 songmid 不能为空',
|
|
43
|
-
data: null
|
|
44
|
-
};
|
|
29
|
+
const result = (0, apiResponse_1.errorResponse)('参数 songmid 不能为空', 400);
|
|
30
|
+
ctx.status = result.status;
|
|
31
|
+
ctx.body = result.body;
|
|
45
32
|
return;
|
|
46
33
|
}
|
|
34
|
+
const { cookie } = (0, cookieResolver_1.resolveRequestCookie)(ctx);
|
|
47
35
|
const result = await getPersonalRecommend_1.default.getSimilarSongs(String(validSongmid), cookie);
|
|
48
36
|
ctx.status = result.status;
|
|
49
37
|
ctx.body = result.body;
|
|
@@ -3,55 +3,49 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getPlaylistTagsController =
|
|
7
|
-
exports.getPlaylistsByTagController = getPlaylistsByTagController;
|
|
8
|
-
exports.getHotCommentsController = getHotCommentsController;
|
|
9
|
-
exports.getSingerListByAreaController = getSingerListByAreaController;
|
|
6
|
+
exports.getSingerListByAreaController = exports.getHotCommentsController = exports.getPlaylistsByTagController = exports.getPlaylistTagsController = void 0;
|
|
10
7
|
const getPlaylistTags_1 = __importDefault(require("../../module/apis/extend/getPlaylistTags"));
|
|
8
|
+
const util_1 = require("../util");
|
|
9
|
+
const apiResponse_1 = require("../../util/apiResponse");
|
|
11
10
|
/**
|
|
12
11
|
* 获取歌单标签列表
|
|
13
12
|
*/
|
|
14
|
-
|
|
13
|
+
const getPlaylistTagsController = (0, util_1.withErrorHandler)(async (ctx) => {
|
|
15
14
|
const result = await getPlaylistTags_1.default.getPlaylistTags();
|
|
16
|
-
ctx
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
(0, util_1.setApiResponse)(ctx, result);
|
|
16
|
+
});
|
|
17
|
+
exports.getPlaylistTagsController = getPlaylistTagsController;
|
|
19
18
|
/**
|
|
20
19
|
* 根据标签获取歌单列表
|
|
21
20
|
*/
|
|
22
|
-
|
|
21
|
+
const getPlaylistsByTagController = (0, util_1.withErrorHandler)(async (ctx) => {
|
|
23
22
|
const { tagId = '1', page = '0', num = '20' } = ctx.query;
|
|
24
23
|
const result = await getPlaylistTags_1.default.getPlaylistsByTag(Number(tagId), Number(page), Number(num));
|
|
25
|
-
ctx
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
(0, util_1.setApiResponse)(ctx, result);
|
|
25
|
+
});
|
|
26
|
+
exports.getPlaylistsByTagController = getPlaylistsByTagController;
|
|
28
27
|
/**
|
|
29
28
|
* 获取热门评论
|
|
30
29
|
*/
|
|
31
|
-
|
|
30
|
+
const getHotCommentsController = (0, util_1.withErrorHandler)(async (ctx) => {
|
|
32
31
|
const { id, type = '1', page = '0', pagesize = '20' } = ctx.query;
|
|
33
32
|
if (!id) {
|
|
34
|
-
ctx.
|
|
35
|
-
ctx.body = {
|
|
36
|
-
code: -1,
|
|
37
|
-
msg: '缺少参数 id(资源 ID)',
|
|
38
|
-
data: null
|
|
39
|
-
};
|
|
33
|
+
(0, util_1.setApiResponse)(ctx, (0, apiResponse_1.errorResponse)('缺少参数 id(资源 ID)', 400));
|
|
40
34
|
return;
|
|
41
35
|
}
|
|
42
36
|
const result = await getPlaylistTags_1.default.getHotComments(id, Number(type), Number(page), Number(pagesize));
|
|
43
|
-
ctx
|
|
44
|
-
|
|
45
|
-
|
|
37
|
+
(0, util_1.setApiResponse)(ctx, result);
|
|
38
|
+
});
|
|
39
|
+
exports.getHotCommentsController = getHotCommentsController;
|
|
46
40
|
/**
|
|
47
41
|
* 获取歌手分类列表
|
|
48
42
|
*/
|
|
49
|
-
|
|
43
|
+
const getSingerListByAreaController = (0, util_1.withErrorHandler)(async (ctx) => {
|
|
50
44
|
const { area = '-1', sex = '-1', genre = '-1', page = '1', pagesize = '80' } = ctx.query;
|
|
51
45
|
const result = await getPlaylistTags_1.default.getSingerListByArea(Number(area), Number(sex), Number(genre), Number(page), Number(pagesize));
|
|
52
|
-
ctx
|
|
53
|
-
|
|
54
|
-
|
|
46
|
+
(0, util_1.setApiResponse)(ctx, result);
|
|
47
|
+
});
|
|
48
|
+
exports.getSingerListByAreaController = getSingerListByAreaController;
|
|
55
49
|
exports.default = {
|
|
56
50
|
getPlaylistTags: getPlaylistTagsController,
|
|
57
51
|
getPlaylistsByTag: getPlaylistsByTagController,
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const module_1 = require("../../module");
|
|
4
|
-
const
|
|
4
|
+
const util_1 = require("../util");
|
|
5
|
+
const apiResponse_1 = require("../../util/apiResponse");
|
|
6
|
+
const getRanksController = (0, util_1.withErrorHandler)(async (ctx) => {
|
|
5
7
|
const getWeekNumber = (d) => {
|
|
6
8
|
d = new Date(Date.UTC(d.getFullYear(), d.getMonth(), d.getDate()));
|
|
7
9
|
const dayNum = d.getUTCDay() || 7;
|
|
@@ -36,25 +38,16 @@ const controller = async (ctx, next) => {
|
|
|
36
38
|
}
|
|
37
39
|
}
|
|
38
40
|
};
|
|
39
|
-
const params =
|
|
41
|
+
const params = {
|
|
40
42
|
format: 'json',
|
|
41
43
|
data: JSON.stringify(data)
|
|
42
|
-
}
|
|
44
|
+
};
|
|
43
45
|
const props = {
|
|
44
46
|
method: 'get',
|
|
45
47
|
params,
|
|
46
48
|
option: {}
|
|
47
49
|
};
|
|
48
|
-
await (0, module_1.UCommon)(props)
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
ctx.body = {
|
|
53
|
-
response
|
|
54
|
-
};
|
|
55
|
-
})
|
|
56
|
-
.catch(error => {
|
|
57
|
-
console.log('error', error);
|
|
58
|
-
});
|
|
59
|
-
};
|
|
60
|
-
exports.default = controller;
|
|
50
|
+
const response = await (0, module_1.UCommon)(props);
|
|
51
|
+
(0, util_1.setApiResponse)(ctx, (0, apiResponse_1.customResponse)({ response: response.data }, 200));
|
|
52
|
+
});
|
|
53
|
+
exports.default = getRanksController;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const module_1 = require("../../module");
|
|
4
|
-
const
|
|
4
|
+
const util_1 = require("../util");
|
|
5
|
+
const apiResponse_1 = require("../../util/apiResponse");
|
|
6
|
+
const getSingerAlbumController = (0, util_1.withErrorHandler)(async (ctx) => {
|
|
5
7
|
const singermid = ctx.query.singermid;
|
|
6
8
|
const num = +ctx.query.limit || 5;
|
|
7
9
|
const begin = +ctx.query.page || 0;
|
|
@@ -21,34 +23,26 @@ const controller = async (ctx, next) => {
|
|
|
21
23
|
module: 'music.musichallAlbum.AlbumListServer'
|
|
22
24
|
}
|
|
23
25
|
};
|
|
24
|
-
const params =
|
|
26
|
+
const params = {
|
|
25
27
|
format: 'json',
|
|
26
28
|
singermid,
|
|
27
29
|
data: JSON.stringify(data)
|
|
28
|
-
}
|
|
30
|
+
};
|
|
29
31
|
const props = {
|
|
30
32
|
method: 'get',
|
|
31
33
|
params,
|
|
32
34
|
option: {}
|
|
33
35
|
};
|
|
34
|
-
if (singermid) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
response
|
|
41
|
-
};
|
|
42
|
-
})
|
|
43
|
-
.catch(error => {
|
|
44
|
-
console.log('error', error);
|
|
36
|
+
if (!singermid) {
|
|
37
|
+
(0, util_1.setApiResponse)(ctx, {
|
|
38
|
+
status: 400,
|
|
39
|
+
body: {
|
|
40
|
+
response: 'no singermid'
|
|
41
|
+
}
|
|
45
42
|
});
|
|
43
|
+
return;
|
|
46
44
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
exports.default = controller;
|
|
45
|
+
const response = await (0, module_1.UCommon)(props);
|
|
46
|
+
(0, util_1.setApiResponse)(ctx, (0, apiResponse_1.customResponse)({ response: response.data }, 200));
|
|
47
|
+
});
|
|
48
|
+
exports.default = getSingerAlbumController;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const module_1 = require("../../module");
|
|
4
|
-
const
|
|
4
|
+
const util_1 = require("../util");
|
|
5
|
+
const apiResponse_1 = require("../../util/apiResponse");
|
|
6
|
+
const getSingerHotsongController = (0, util_1.withErrorHandler)(async (ctx) => {
|
|
5
7
|
const singermid = ctx.query.singermid;
|
|
6
8
|
const num = +ctx.query.limit || 5;
|
|
7
9
|
const page = +ctx.query.page || 0;
|
|
@@ -21,34 +23,26 @@ const controller = async (ctx, next) => {
|
|
|
21
23
|
module: 'music.web_singer_info_svr'
|
|
22
24
|
}
|
|
23
25
|
};
|
|
24
|
-
const params =
|
|
26
|
+
const params = {
|
|
25
27
|
format: 'json',
|
|
26
28
|
singermid,
|
|
27
29
|
data: JSON.stringify(data)
|
|
28
|
-
}
|
|
30
|
+
};
|
|
29
31
|
const props = {
|
|
30
32
|
method: 'get',
|
|
31
33
|
params,
|
|
32
34
|
option: {}
|
|
33
35
|
};
|
|
34
|
-
if (singermid) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
response
|
|
41
|
-
};
|
|
42
|
-
})
|
|
43
|
-
.catch(error => {
|
|
44
|
-
console.log('error', error);
|
|
36
|
+
if (!singermid) {
|
|
37
|
+
(0, util_1.setApiResponse)(ctx, {
|
|
38
|
+
status: 400,
|
|
39
|
+
body: {
|
|
40
|
+
response: 'no singermid'
|
|
41
|
+
}
|
|
45
42
|
});
|
|
43
|
+
return;
|
|
46
44
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
exports.default = controller;
|
|
45
|
+
const response = await (0, module_1.UCommon)(props);
|
|
46
|
+
(0, util_1.setApiResponse)(ctx, (0, apiResponse_1.customResponse)({ response: response.data }, 200));
|
|
47
|
+
});
|
|
48
|
+
exports.default = getSingerHotsongController;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const module_1 = require("../../module");
|
|
4
|
-
const
|
|
4
|
+
const util_1 = require("../util");
|
|
5
|
+
const apiResponse_1 = require("../../util/apiResponse");
|
|
6
|
+
const getSingerListController = (0, util_1.withErrorHandler)(async (ctx) => {
|
|
5
7
|
const { area = -100, sex = -100, genre = -100, index = -100, page = 1 } = ctx.query;
|
|
6
8
|
const pageNum = Number(page);
|
|
7
9
|
const data = {
|
|
@@ -22,30 +24,16 @@ const controller = async (ctx, next) => {
|
|
|
22
24
|
}
|
|
23
25
|
}
|
|
24
26
|
};
|
|
25
|
-
const params =
|
|
27
|
+
const params = {
|
|
26
28
|
format: 'json',
|
|
27
29
|
data: JSON.stringify(data)
|
|
28
|
-
}
|
|
30
|
+
};
|
|
29
31
|
const props = {
|
|
30
32
|
method: 'get',
|
|
31
33
|
params,
|
|
32
34
|
option: {}
|
|
33
35
|
};
|
|
34
|
-
await (0, module_1.UCommon)(props)
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
ctx.body = {
|
|
39
|
-
status: 200,
|
|
40
|
-
response
|
|
41
|
-
};
|
|
42
|
-
})
|
|
43
|
-
.catch(error => {
|
|
44
|
-
console.error('getSingerList error:', error);
|
|
45
|
-
ctx.status = 500;
|
|
46
|
-
ctx.body = {
|
|
47
|
-
error: '服务器内部错误'
|
|
48
|
-
};
|
|
49
|
-
});
|
|
50
|
-
};
|
|
51
|
-
exports.default = controller;
|
|
36
|
+
const response = await (0, module_1.UCommon)(props);
|
|
37
|
+
(0, util_1.setApiResponse)(ctx, (0, apiResponse_1.customResponse)({ response: response.data }, 200));
|
|
38
|
+
});
|
|
39
|
+
exports.default = getSingerListController;
|