@sansenjian/qq-music-api 1.0.6 → 2.0.0

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.
Files changed (94) hide show
  1. package/.babelrc +2 -2
  2. package/.dockerignore +5 -5
  3. package/.editorconfig +31 -31
  4. package/.eslintrc.json +21 -17
  5. package/.github/FUNDING.yml +12 -12
  6. package/.github/ISSUE_TEMPLATE/bug_report.md +38 -38
  7. package/.github/ISSUE_TEMPLATE/custom.md +24 -24
  8. package/.github/ISSUE_TEMPLATE/feature_request.md +20 -20
  9. package/.github/workflows/publish.yml +26 -0
  10. package/.husky/commit-msg +1 -0
  11. package/.husky/pre-commit +1 -0
  12. package/.prettierignore +1 -1
  13. package/.prettierrc +9 -9
  14. package/CHANGELOG.md +70 -70
  15. package/Dockerfile +18 -18
  16. package/LICENSE +21 -21
  17. package/README.md +218 -177
  18. package/app.js +75 -75
  19. package/commitlint.config.js +20 -20
  20. package/config/user-info.js +42 -42
  21. package/index.js +1 -1
  22. package/middlewares/koa-cors.js +97 -97
  23. package/module/apis/UCommon/UCommon.js +6 -6
  24. package/module/apis/album/getAlbumInfo.js +33 -33
  25. package/module/apis/comments/getComments.js +35 -35
  26. package/module/apis/digitalAlbum/getDigitalAlbumLists.js +34 -34
  27. package/module/apis/downloadQQMusic.js +41 -41
  28. package/module/apis/music/getLyric.js +42 -41
  29. package/module/apis/mv/getMvByTag.js +35 -35
  30. package/module/apis/radio/getRadioLists.js +38 -38
  31. package/module/apis/rank/getTopLists.js +44 -44
  32. package/module/apis/search/getHotKey.js +35 -35
  33. package/module/apis/search/getSearchByKey.js +45 -45
  34. package/module/apis/search/getSmartbox.js +34 -34
  35. package/module/apis/singers/getSimilarSinger.js +36 -36
  36. package/module/apis/singers/getSingerDesc.js +38 -38
  37. package/module/apis/singers/getSingerMv.js +35 -35
  38. package/module/apis/singers/getSingerStarNum.js +36 -36
  39. package/module/apis/songLists/songListCategories.js +33 -33
  40. package/module/apis/songLists/songListDetail.js +38 -38
  41. package/module/apis/songLists/songLists.js +41 -41
  42. package/module/apis/u_common.js +17 -16
  43. package/module/apis/user/checkQQLoginQr.js +125 -86
  44. package/module/apis/user/getQQLoginQr.js +17 -11
  45. package/module/apis/y_common.js +27 -14
  46. package/module/config.js +31 -31
  47. package/module/index.js +82 -82
  48. package/package.json +72 -83
  49. package/public/index.html +47 -47
  50. package/routers/context/batchGetSongInfo.js +59 -59
  51. package/routers/context/batchGetSongLists.js +50 -50
  52. package/routers/context/checkQQLoginQr.js +17 -15
  53. package/routers/context/cookies.js +36 -36
  54. package/routers/context/getAlbumInfo.js +27 -27
  55. package/routers/context/getComments.js +51 -51
  56. package/routers/context/getDigitalAlbumLists.js +14 -14
  57. package/routers/context/getDownloadQQMusic.js +14 -14
  58. package/routers/context/getHotkey.js +14 -14
  59. package/routers/context/getImageUrl.js +34 -34
  60. package/routers/context/getLyric.js +26 -26
  61. package/routers/context/getMusicPlay.js +116 -112
  62. package/routers/context/getMv.js +56 -56
  63. package/routers/context/getMvByTag.js +15 -15
  64. package/routers/context/getMvPlay.js +128 -118
  65. package/routers/context/getNewDisks.js +50 -51
  66. package/routers/context/getQQLoginQr.js +12 -12
  67. package/routers/context/getRadioLists.js +14 -14
  68. package/routers/context/getRanks.js +90 -86
  69. package/routers/context/getRecommend.js +86 -86
  70. package/routers/context/getSearchByKey.js +32 -32
  71. package/routers/context/getSimilarSinger.js +25 -25
  72. package/routers/context/getSingerAlbum.js +52 -52
  73. package/routers/context/getSingerDesc.js +25 -25
  74. package/routers/context/getSingerHotsong.js +52 -52
  75. package/routers/context/getSingerList.js +51 -52
  76. package/routers/context/getSingerMv.js +32 -32
  77. package/routers/context/getSingerStarNum.js +24 -24
  78. package/routers/context/getSmartbox.js +24 -24
  79. package/routers/context/getSongInfo.js +49 -49
  80. package/routers/context/getSongListCategories.js +22 -22
  81. package/routers/context/getSongListDetail.js +25 -25
  82. package/routers/context/getSongLists.js +32 -32
  83. package/routers/context/getTicketInfo.js +45 -45
  84. package/routers/context/getTopLists.js +15 -15
  85. package/routers/context/index.js +74 -74
  86. package/routers/router.js +116 -112
  87. package/scripts/build-images.js +36 -36
  88. package/scripts/commit-push.sh +103 -103
  89. package/util/colors.js +16 -16
  90. package/util/cookie.js +22 -22
  91. package/util/loginUtils.js +28 -23
  92. package/util/lyricParse.js +64 -64
  93. package/util/request.js +57 -57
  94. package/vercel.json +15 -15
@@ -1,51 +1,50 @@
1
- const { UCommon } = require('../../module');
2
- const { commonParams } = require('../../module/config');
3
-
4
- module.exports = 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 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
- };
1
+ const { UCommon } = require('../../module');
2
+
3
+ module.exports = async (ctx, next) => {
4
+ const page = +ctx.query.page || 1;
5
+ const num = +ctx.query.limit || 20;
6
+ const start = (page - 1) * num;
7
+ const data = {
8
+ new_album: {
9
+ module: 'newalbum.NewAlbumServer',
10
+ method: 'get_new_album_info',
11
+ param: {
12
+ area: 1,
13
+ start,
14
+ num,
15
+ },
16
+ },
17
+ comm: {
18
+ ct: 24,
19
+ cv: 0,
20
+ },
21
+ };
22
+ if (!start) {
23
+ data.new_album_tag = {
24
+ module: 'newalbum.NewAlbumServer',
25
+ method: 'get_new_album_area',
26
+ param: {},
27
+ };
28
+ }
29
+ const params = Object.assign({
30
+ format: 'json',
31
+ data: JSON.stringify(data),
32
+ });
33
+ const props = {
34
+ method: 'get',
35
+ params,
36
+ option: {},
37
+ };
38
+ await UCommon(props)
39
+ .then(res => {
40
+ const response = res.data;
41
+ ctx.status = 200;
42
+ ctx.body = {
43
+ status: 200,
44
+ response,
45
+ };
46
+ })
47
+ .catch(error => {
48
+ console.log('error', error);
49
+ });
50
+ };
@@ -1,12 +1,12 @@
1
- const { getQQLoginQr } = require('../../module');
2
-
3
- module.exports = async (ctx, next) => {
4
- const props = {
5
- method: 'get',
6
- };
7
- const { status, body } = await getQQLoginQr(props);
8
- Object.assign(ctx, {
9
- status,
10
- body,
11
- });
12
- };
1
+ const { getQQLoginQr } = require('../../module');
2
+
3
+ module.exports = async (ctx, next) => {
4
+ const props = {
5
+ method: 'get',
6
+ };
7
+ const { status, body } = await getQQLoginQr(props);
8
+ Object.assign(ctx, {
9
+ status,
10
+ body,
11
+ });
12
+ };
@@ -1,14 +1,14 @@
1
- const { getRadioLists } = require('../../module');
2
-
3
- module.exports = async (ctx, next) => {
4
- const props = {
5
- method: 'get',
6
- params: {},
7
- option: {},
8
- };
9
- const { status, body } = await getRadioLists(props);
10
- Object.assign(ctx, {
11
- status,
12
- body,
13
- });
14
- };
1
+ const { getRadioLists } = require('../../module');
2
+
3
+ module.exports = async (ctx, next) => {
4
+ const props = {
5
+ method: 'get',
6
+ params: {},
7
+ option: {},
8
+ };
9
+ const { status, body } = await getRadioLists(props);
10
+ Object.assign(ctx, {
11
+ status,
12
+ body,
13
+ });
14
+ };
@@ -1,86 +1,90 @@
1
- const { UCommon } = require('../../module');
2
- const { commonParams } = require('../../module/config');
3
- const moment = require('moment');
4
-
5
- module.exports = async (ctx, next) => {
6
- // Desc: https://github.com/Rain120/qq-music-api/issues/14
7
- // 1. topId is useless
8
- // 2. qq api period is change not YYYY-MM-DD
9
- const topId = +ctx.query.topId || 4;
10
- const num = +ctx.query.limit || 20;
11
- const offset = +ctx.query.page || 0;
12
- const date = ctx.query.period || moment();
13
- const week = moment(date).isoWeek();
14
- const year = moment(date).year();
15
- const period = `${year}_${week}`;
16
-
17
- const data = {
18
- comm: {
19
- ...(commonParams || {}),
20
- cv: 4747474,
21
- ct: 24,
22
- format: 'json',
23
- inCharset: 'utf-8',
24
- needNewCode: 1,
25
- uin: 0,
26
- },
27
- req_1: {
28
- module: 'musicToplist.ToplistInfoServer',
29
- method: 'GetDetail',
30
- param: {
31
- topId,
32
- offset,
33
- num,
34
- period,
35
- },
36
- },
37
- // TODO: 新评论,之后迭代更新再说
38
- // req_2: {
39
- // module: 'music.globalComment.CommentReadServer',
40
- // method: 'GetNewCommentList',
41
- // param: {
42
- // BizType: 4,
43
- // BizId: '59',
44
- // LastCommentSeqNo: '',
45
- // PageSize: 25,
46
- // PageNum: 0,
47
- // FromCommentId: '',
48
- // WithHot: 1,
49
- // },
50
- // },
51
- // TODO: 热门评论,之后迭代更新再说
52
- // req_3: {
53
- // module: 'music.globalComment.CommentReadServer',
54
- // method: 'GetHotCommentList',
55
- // param: {
56
- // BizType: 4,
57
- // BizId: '59',
58
- // LastCommentSeqNo: '',
59
- // PageSize: 15,
60
- // PageNum: 0,
61
- // HotType: 2,
62
- // WithAirborne: 1,
63
- // },
64
- // },
65
- };
66
- const params = Object.assign({
67
- format: 'json',
68
- data: JSON.stringify(data),
69
- });
70
- const props = {
71
- method: 'get',
72
- params,
73
- option: {},
74
- };
75
- await UCommon(props)
76
- .then(res => {
77
- const response = res.data;
78
- ctx.status = 200;
79
- ctx.body = {
80
- response,
81
- };
82
- })
83
- .catch(error => {
84
- console.log('error', error);
85
- });
86
- };
1
+ const { UCommon } = require('../../module');
2
+ const { commonParams } = require('../../module/config');
3
+ const dayjs = require('dayjs');
4
+ const isoWeek = require('dayjs/plugin/isoWeek');
5
+ const isoWeekYear = require('dayjs/plugin/isoWeekYear');
6
+ dayjs.extend(isoWeek);
7
+ dayjs.extend(isoWeekYear);
8
+
9
+ module.exports = async (ctx, next) => {
10
+ // Desc: https://github.com/Rain120/qq-music-api/issues/14
11
+ // 1. topId is useless
12
+ // 2. qq api period is change not YYYY-MM-DD
13
+ const topId = +ctx.query.topId || 4;
14
+ const num = +ctx.query.limit || 20;
15
+ const offset = +ctx.query.page || 0;
16
+ const date = ctx.query.period || dayjs();
17
+ const week = dayjs(date).isoWeek();
18
+ const isoWeekYearVal = dayjs(date).isoWeekYear();
19
+ const period = `${isoWeekYearVal}_${week}`;
20
+
21
+ const data = {
22
+ comm: {
23
+ ...(commonParams || {}),
24
+ cv: 4747474,
25
+ ct: 24,
26
+ format: 'json',
27
+ inCharset: 'utf-8',
28
+ needNewCode: 1,
29
+ uin: 0,
30
+ },
31
+ req_1: {
32
+ module: 'musicToplist.ToplistInfoServer',
33
+ method: 'GetDetail',
34
+ param: {
35
+ topId,
36
+ offset,
37
+ num,
38
+ period,
39
+ },
40
+ },
41
+ // TODO: 新评论,之后迭代更新再说
42
+ // req_2: {
43
+ // module: 'music.globalComment.CommentReadServer',
44
+ // method: 'GetNewCommentList',
45
+ // param: {
46
+ // BizType: 4,
47
+ // BizId: '59',
48
+ // LastCommentSeqNo: '',
49
+ // PageSize: 25,
50
+ // PageNum: 0,
51
+ // FromCommentId: '',
52
+ // WithHot: 1,
53
+ // },
54
+ // },
55
+ // TODO: 热门评论,之后迭代更新再说
56
+ // req_3: {
57
+ // module: 'music.globalComment.CommentReadServer',
58
+ // method: 'GetHotCommentList',
59
+ // param: {
60
+ // BizType: 4,
61
+ // BizId: '59',
62
+ // LastCommentSeqNo: '',
63
+ // PageSize: 15,
64
+ // PageNum: 0,
65
+ // HotType: 2,
66
+ // WithAirborne: 1,
67
+ // },
68
+ // },
69
+ };
70
+ const params = Object.assign({
71
+ format: 'json',
72
+ data: JSON.stringify(data),
73
+ });
74
+ const props = {
75
+ method: 'get',
76
+ params,
77
+ option: {},
78
+ };
79
+ await UCommon(props)
80
+ .then(res => {
81
+ const response = res.data;
82
+ ctx.status = 200;
83
+ ctx.body = {
84
+ response,
85
+ };
86
+ })
87
+ .catch(error => {
88
+ console.log('error', error);
89
+ });
90
+ };
@@ -1,86 +1,86 @@
1
- const { UCommon } = require('../../module');
2
-
3
- module.exports = async (ctx, next) => {
4
- const data = {
5
- comm: {
6
- ct: 24,
7
- },
8
- category: {
9
- method: 'get_hot_category',
10
- param: {
11
- qq: '',
12
- },
13
- module: 'music.web_category_svr',
14
- },
15
- recomPlaylist: {
16
- method: 'get_hot_recommend',
17
- param: {
18
- async: 1,
19
- cmd: 2,
20
- },
21
- module: 'playlist.HotRecommendServer',
22
- },
23
- playlist: {
24
- method: 'get_playlist_by_category',
25
- param: {
26
- id: 8,
27
- curPage: 1,
28
- size: 40,
29
- order: 5,
30
- titleid: 8,
31
- },
32
- module: 'playlist.PlayListPlazaServer',
33
- },
34
- new_song: {
35
- module: 'newsong.NewSongServer',
36
- method: 'get_new_song_info',
37
- param: {
38
- type: 5,
39
- },
40
- },
41
- new_album: {
42
- module: 'newalbum.NewAlbumServer',
43
- method: 'get_new_album_info',
44
- param: {
45
- area: 1,
46
- sin: 0,
47
- num: 10,
48
- },
49
- },
50
- new_album_tag: {
51
- module: 'newalbum.NewAlbumServer',
52
- method: 'get_new_album_area',
53
- param: {},
54
- },
55
- toplist: {
56
- module: 'musicToplist.ToplistInfoServer',
57
- method: 'GetAll',
58
- param: {},
59
- },
60
- focus: {
61
- module: 'QQMusic.MusichallServer',
62
- method: 'GetFocus',
63
- param: {},
64
- },
65
- };
66
- const params = Object.assign({
67
- format: 'json',
68
- data: JSON.stringify(data),
69
- });
70
- const props = {
71
- method: 'get',
72
- params,
73
- option: {},
74
- };
75
- await UCommon(props)
76
- .then(res => {
77
- const response = res.data;
78
- ctx.status = 200;
79
- ctx.body = {
80
- response,
81
- };
82
- })
83
- .catch(error => {
84
- console.log('error', error);
85
- });
86
- };
1
+ const { UCommon } = require('../../module');
2
+
3
+ module.exports = async (ctx, next) => {
4
+ const data = {
5
+ comm: {
6
+ ct: 24,
7
+ },
8
+ category: {
9
+ method: 'get_hot_category',
10
+ param: {
11
+ qq: '',
12
+ },
13
+ module: 'music.web_category_svr',
14
+ },
15
+ recomPlaylist: {
16
+ method: 'get_hot_recommend',
17
+ param: {
18
+ async: 1,
19
+ cmd: 2,
20
+ },
21
+ module: 'playlist.HotRecommendServer',
22
+ },
23
+ playlist: {
24
+ method: 'get_playlist_by_category',
25
+ param: {
26
+ id: 8,
27
+ curPage: 1,
28
+ size: 40,
29
+ order: 5,
30
+ titleid: 8,
31
+ },
32
+ module: 'playlist.PlayListPlazaServer',
33
+ },
34
+ new_song: {
35
+ module: 'newsong.NewSongServer',
36
+ method: 'get_new_song_info',
37
+ param: {
38
+ type: 5,
39
+ },
40
+ },
41
+ new_album: {
42
+ module: 'newalbum.NewAlbumServer',
43
+ method: 'get_new_album_info',
44
+ param: {
45
+ area: 1,
46
+ sin: 0,
47
+ num: 10,
48
+ },
49
+ },
50
+ new_album_tag: {
51
+ module: 'newalbum.NewAlbumServer',
52
+ method: 'get_new_album_area',
53
+ param: {},
54
+ },
55
+ toplist: {
56
+ module: 'musicToplist.ToplistInfoServer',
57
+ method: 'GetAll',
58
+ param: {},
59
+ },
60
+ focus: {
61
+ module: 'QQMusic.MusichallServer',
62
+ method: 'GetFocus',
63
+ param: {},
64
+ },
65
+ };
66
+ const params = Object.assign({
67
+ format: 'json',
68
+ data: JSON.stringify(data),
69
+ });
70
+ const props = {
71
+ method: 'get',
72
+ params,
73
+ option: {},
74
+ };
75
+ await UCommon(props)
76
+ .then(res => {
77
+ const response = res.data;
78
+ ctx.status = 200;
79
+ ctx.body = {
80
+ response,
81
+ };
82
+ })
83
+ .catch(error => {
84
+ console.log('error', error);
85
+ });
86
+ };
@@ -1,32 +1,32 @@
1
- const { getSearchByKey } = require('../../module');
2
-
3
- // w:搜索关键字
4
- // p:当前页
5
- // n:每页歌曲数量
6
- // catZhida: 0表示歌曲, 2表示歌手, 3表示专辑, 4, 5
7
- module.exports = async (ctx, next) => {
8
- const { key: w, limit: n, page: p, catZhida, remoteplace = 'song' } = ctx.query;
9
- const props = {
10
- method: 'get',
11
- params: {
12
- w,
13
- n: +n || 10,
14
- p: +p || 1,
15
- catZhida: +catZhida || 1,
16
- remoteplace: `txt.yqq.${remoteplace}`,
17
- },
18
- option: {},
19
- };
20
- if (w) {
21
- const { status, body } = await getSearchByKey(props);
22
- Object.assign(ctx, {
23
- status,
24
- body,
25
- });
26
- } else {
27
- ctx.status = 400;
28
- ctx.body = {
29
- response: 'search key is null',
30
- };
31
- }
32
- };
1
+ const { getSearchByKey } = require('../../module');
2
+
3
+ // w:搜索关键字
4
+ // p:当前页
5
+ // n:每页歌曲数量
6
+ // catZhida: 0表示歌曲, 2表示歌手, 3表示专辑, 4, 5
7
+ module.exports = async (ctx, next) => {
8
+ const { key: w, limit: n, page: p, catZhida, remoteplace = 'song' } = ctx.query;
9
+ const props = {
10
+ method: 'get',
11
+ params: {
12
+ w,
13
+ n: +n || 10,
14
+ p: +p || 1,
15
+ catZhida: +catZhida || 1,
16
+ remoteplace: `txt.yqq.${remoteplace}`,
17
+ },
18
+ option: {},
19
+ };
20
+ if (w) {
21
+ const { status, body } = await getSearchByKey(props);
22
+ Object.assign(ctx, {
23
+ status,
24
+ body,
25
+ });
26
+ } else {
27
+ ctx.status = 400;
28
+ ctx.body = {
29
+ response: 'search key is null',
30
+ };
31
+ }
32
+ };
@@ -1,25 +1,25 @@
1
- const { getSimilarSinger } = require('../../module');
2
-
3
- // singermid=0025NhlN2yWrP4
4
- module.exports = async (ctx, next) => {
5
- const { singermid: singer_mid } = ctx.query;
6
- const props = {
7
- method: 'get',
8
- params: {
9
- singer_mid,
10
- },
11
- option: {},
12
- };
13
- if (singer_mid) {
14
- const { status, body } = await getSimilarSinger(props);
15
- Object.assign(ctx, {
16
- status,
17
- body,
18
- });
19
- } else {
20
- ctx.status = 400;
21
- ctx.body = {
22
- response: 'no singermid',
23
- };
24
- }
25
- };
1
+ const { getSimilarSinger } = require('../../module');
2
+
3
+ // singermid=0025NhlN2yWrP4
4
+ module.exports = async (ctx, next) => {
5
+ const { singermid: singer_mid } = ctx.query;
6
+ const props = {
7
+ method: 'get',
8
+ params: {
9
+ singer_mid,
10
+ },
11
+ option: {},
12
+ };
13
+ if (singer_mid) {
14
+ const { status, body } = await getSimilarSinger(props);
15
+ Object.assign(ctx, {
16
+ status,
17
+ body,
18
+ });
19
+ } else {
20
+ ctx.status = 400;
21
+ ctx.body = {
22
+ response: 'no singermid',
23
+ };
24
+ }
25
+ };