@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,50 +1,50 @@
1
- const { songLists } = require('../../module');
2
-
3
- /**
4
- * @description: 2, 3
5
- * @param {page} 页数
6
- * @param {limit} 每页条数[20, 60]
7
- * @param {categoryId} 分类
8
- * @param {sortId} 分类
9
- * @return:
10
- */
11
- module.exports = async (ctx, next) => {
12
- const { limit: ein = 19, page: sin = 0, sortId = 5, categoryIds = [10000000] } = ctx.request.body;
13
-
14
- const params = {
15
- sortId,
16
- sin,
17
- ein,
18
- };
19
-
20
- const props = {
21
- method: 'get',
22
- option: {},
23
- params,
24
- };
25
-
26
- const data = await Promise.all(
27
- categoryIds.map(
28
- async categoryId =>
29
- await songLists({
30
- ...props,
31
- params: {
32
- ...params,
33
- categoryId,
34
- },
35
- }).then(res => {
36
- if (res.body.response && +res.body.response.code === 0) {
37
- return res.body.response.data;
38
- } else {
39
- return res.body.response;
40
- }
41
- }),
42
- ),
43
- );
44
- Object.assign(ctx, {
45
- body: {
46
- status: 200,
47
- data,
48
- },
49
- });
50
- };
1
+ const { songLists } = require('../../module');
2
+
3
+ /**
4
+ * @description: 2, 3
5
+ * @param {page} 页数
6
+ * @param {limit} 每页条数[20, 60]
7
+ * @param {categoryId} 分类
8
+ * @param {sortId} 分类
9
+ * @return:
10
+ */
11
+ module.exports = async (ctx, next) => {
12
+ const { limit: ein = 19, page: sin = 0, sortId = 5, categoryIds = [10000000] } = ctx.request.body;
13
+
14
+ const params = {
15
+ sortId,
16
+ sin,
17
+ ein,
18
+ };
19
+
20
+ const props = {
21
+ method: 'get',
22
+ option: {},
23
+ params,
24
+ };
25
+
26
+ const data = await Promise.all(
27
+ categoryIds.map(
28
+ async categoryId =>
29
+ await songLists({
30
+ ...props,
31
+ params: {
32
+ ...params,
33
+ categoryId,
34
+ },
35
+ }).then(res => {
36
+ if (res.body.response && +res.body.response.code === 0) {
37
+ return res.body.response.data;
38
+ } else {
39
+ return res.body.response;
40
+ }
41
+ }),
42
+ ),
43
+ );
44
+ Object.assign(ctx, {
45
+ body: {
46
+ status: 200,
47
+ data,
48
+ },
49
+ });
50
+ };
@@ -1,15 +1,17 @@
1
- const { checkQQLoginQr } = require('../../module');
2
-
3
- module.exports = async (ctx, next) => {
4
- const { ptqrtoken, qrsig } = ctx.request.body;
5
-
6
- const params = { ptqrtoken, qrsig };
7
-
8
- const props = {
9
- method: 'get',
10
- option: {},
11
- params,
12
- };
13
- const data = await checkQQLoginQr(props);
14
- Object.assign(ctx, { body: data });
15
- };
1
+ const { checkQQLoginQr } = require('../../module');
2
+
3
+ module.exports = async (ctx, next) => {
4
+ const { ptqrtoken, qrsig } = ctx.query.ptqrtoken
5
+ ? ctx.query
6
+ : ctx.request.body || {};
7
+
8
+ const params = { ptqrtoken, qrsig };
9
+
10
+ const props = {
11
+ method: 'get',
12
+ option: {},
13
+ params,
14
+ };
15
+ const data = await checkQQLoginQr(props);
16
+ Object.assign(ctx, { body: data });
17
+ };
@@ -1,36 +1,36 @@
1
- /*
2
- * @Author: Rainy [https://github.com/rain120]
3
- * @Date: 2021-01-23 15:41:41
4
- * @LastEditors: Rainy
5
- * @LastEditTime: 2021-06-19 22:22:31
6
- */
7
- module.exports = {
8
- get: async (ctx, next) => {
9
- ctx.status = 200;
10
- ctx.body = {
11
- data: {
12
- code: 200,
13
- cookie: global.userInfo.cookie,
14
- cookieList: global.userInfo.cookieList,
15
- cookieObject: global.userInfo.cookieObject,
16
- },
17
- };
18
-
19
- await next();
20
- },
21
- set: async (ctx, next) => {
22
- ctx.request.cookies = global.userInfo.cookie;
23
- ctx.request.header['Access-Control-Allow-Origin'] = 'https://y.qq.com';
24
- ctx.request.header['Access-Control-Allow-Methods'] = 'GET,PUT,POST,DELETE';
25
- ctx.request.header['Access-Control-Allow-Headers'] = 'Content-Type';
26
- ctx.request.header['Access-Control-Allow-Credentials'] = true;
27
- ctx.body = {
28
- data: {
29
- code: 200,
30
- message: '操作成功',
31
- }
32
- };
33
-
34
- await next();
35
- },
36
- }
1
+ /*
2
+ * @Author: Rainy [https://github.com/rain120]
3
+ * @Date: 2021-01-23 15:41:41
4
+ * @LastEditors: Rainy
5
+ * @LastEditTime: 2021-06-19 22:22:31
6
+ */
7
+ module.exports = {
8
+ get: async (ctx, next) => {
9
+ ctx.status = 200;
10
+ ctx.body = {
11
+ data: {
12
+ code: 200,
13
+ cookie: global.userInfo.cookie,
14
+ cookieList: global.userInfo.cookieList,
15
+ cookieObject: global.userInfo.cookieObject,
16
+ },
17
+ };
18
+
19
+ await next();
20
+ },
21
+ set: async (ctx, next) => {
22
+ ctx.request.cookies = global.userInfo.cookie;
23
+ ctx.request.header['Access-Control-Allow-Origin'] = 'https://y.qq.com';
24
+ ctx.request.header['Access-Control-Allow-Methods'] = 'GET,PUT,POST,DELETE';
25
+ ctx.request.header['Access-Control-Allow-Headers'] = 'Content-Type';
26
+ ctx.request.header['Access-Control-Allow-Credentials'] = true;
27
+ ctx.body = {
28
+ data: {
29
+ code: 200,
30
+ message: '操作成功',
31
+ },
32
+ };
33
+
34
+ await next();
35
+ },
36
+ };
@@ -1,27 +1,27 @@
1
- const { getAlbumInfo } = require('../../module');
2
-
3
- // albummid=0016l2F430zMux
4
- module.exports = async (ctx, next) => {
5
- const { albummid } = ctx.query;
6
- const props = {
7
- method: 'get',
8
- params: {
9
- albummid,
10
- },
11
- option: {},
12
- };
13
- if (albummid) {
14
- const { status, body } = await getAlbumInfo(props);
15
- Object.assign(ctx, {
16
- status,
17
- body,
18
- });
19
- } else {
20
- ctx.status = 400;
21
- ctx.body = {
22
- data: {
23
- message: 'no albummid'
24
- },
25
- };
26
- }
27
- };
1
+ const { getAlbumInfo } = require('../../module');
2
+
3
+ // albummid=0016l2F430zMux
4
+ module.exports = async (ctx, next) => {
5
+ const { albummid } = ctx.query;
6
+ const props = {
7
+ method: 'get',
8
+ params: {
9
+ albummid,
10
+ },
11
+ option: {},
12
+ };
13
+ if (albummid) {
14
+ const { status, body } = await getAlbumInfo(props);
15
+ Object.assign(ctx, {
16
+ status,
17
+ body,
18
+ });
19
+ } else {
20
+ ctx.status = 400;
21
+ ctx.body = {
22
+ data: {
23
+ message: 'no albummid',
24
+ },
25
+ };
26
+ }
27
+ };
@@ -1,51 +1,51 @@
1
- const { getComments } = require('../../module');
2
-
3
- // comments: params error
4
- // id: 专辑或者歌单请求结果的id
5
- // rootcommentid: 上一次请求结果的最后一项, comment.commentlist[commentlist.length - 1].rootcommentid
6
- // id=8220
7
- // rootcommentid=album_8220_1003310416_1558068713
8
- // cid=205360772
9
- module.exports = async (ctx, next) => {
10
- const {
11
- id,
12
- pagesize = 25,
13
- pagenum = 0,
14
- cid = 205360772,
15
- cmd = 8,
16
- reqtype = 2,
17
- biztype = 1,
18
- rootcommentid = !pagenum && '',
19
- } = ctx.query;
20
- const checkrootcommentid = !pagenum ? true : !!rootcommentid;
21
-
22
- const params = Object.assign({
23
- cid,
24
- reqtype,
25
- biztype,
26
- topid: id,
27
- cmd,
28
- pagenum,
29
- pagesize,
30
- lasthotcommentid: rootcommentid,
31
- });
32
- const props = {
33
- method: 'get',
34
- params,
35
- option: {},
36
- };
37
- if (id && checkrootcommentid) {
38
- const { status, body } = await getComments(props);
39
- Object.assign(ctx, {
40
- status,
41
- body,
42
- });
43
- } else {
44
- ctx.status = 400;
45
- ctx.body = {
46
- data: {
47
- message: "Don't have id or rootcommentid",
48
- }
49
- };
50
- }
51
- };
1
+ const { getComments } = require('../../module');
2
+
3
+ // comments: params error
4
+ // id: 专辑或者歌单请求结果的id
5
+ // rootcommentid: 上一次请求结果的最后一项, comment.commentlist[commentlist.length - 1].rootcommentid
6
+ // id=8220
7
+ // rootcommentid=album_8220_1003310416_1558068713
8
+ // cid=205360772
9
+ module.exports = async (ctx, next) => {
10
+ const {
11
+ id,
12
+ pagesize = 25,
13
+ pagenum = 0,
14
+ cid = 205360772,
15
+ cmd = 8,
16
+ reqtype = 2,
17
+ biztype = 1,
18
+ rootcommentid = !pagenum && '',
19
+ } = ctx.query;
20
+ const checkrootcommentid = !pagenum ? true : !!rootcommentid;
21
+
22
+ const params = Object.assign({
23
+ cid,
24
+ reqtype,
25
+ biztype,
26
+ topid: id,
27
+ cmd,
28
+ pagenum,
29
+ pagesize,
30
+ lasthotcommentid: rootcommentid,
31
+ });
32
+ const props = {
33
+ method: 'get',
34
+ params,
35
+ option: {},
36
+ };
37
+ if (id && checkrootcommentid) {
38
+ const { status, body } = await getComments(props);
39
+ Object.assign(ctx, {
40
+ status,
41
+ body,
42
+ });
43
+ } else {
44
+ ctx.status = 400;
45
+ ctx.body = {
46
+ data: {
47
+ message: "Don't have id or rootcommentid",
48
+ },
49
+ };
50
+ }
51
+ };
@@ -1,14 +1,14 @@
1
- const { getDigitalAlbumLists } = 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 getDigitalAlbumLists(props);
10
- Object.assign(ctx, {
11
- status,
12
- body,
13
- });
14
- };
1
+ const { getDigitalAlbumLists } = 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 getDigitalAlbumLists(props);
10
+ Object.assign(ctx, {
11
+ status,
12
+ body,
13
+ });
14
+ };
@@ -1,14 +1,14 @@
1
- const { downloadQQMusic } = 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 downloadQQMusic(props);
10
- Object.assign(ctx, {
11
- status,
12
- body,
13
- });
14
- };
1
+ const { downloadQQMusic } = 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 downloadQQMusic(props);
10
+ Object.assign(ctx, {
11
+ status,
12
+ body,
13
+ });
14
+ };
@@ -1,14 +1,14 @@
1
- const { getHotKey } = 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 getHotKey(props);
10
- Object.assign(ctx, {
11
- status,
12
- body,
13
- });
14
- };
1
+ const { getHotKey } = 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 getHotKey(props);
10
+ Object.assign(ctx, {
11
+ status,
12
+ body,
13
+ });
14
+ };
@@ -1,34 +1,34 @@
1
- /*
2
- * @Author: Rainy
3
- * @Date: 2020-05-24 12:12:03
4
- * @LastEditors: Rainy
5
- * @LastEditTime: 2020-05-24 12:51:23
6
- */
7
-
8
- /**
9
- * @description 获取图片地址
10
- * @param {歌曲 mid / pmid, 专辑 albumMID} id
11
- * @param {string} size 图片大小 default 300x300
12
- * @param {number} maxAge default 2592000
13
- */
14
- module.exports = (ctx, next) => {
15
- const { id, size = '300x300', maxAge = 2592000 } = ctx.query;
16
- if (!id) {
17
- ctx.status = 400;
18
- ctx.body = {
19
- response: 'no id~~',
20
- };
21
- }
22
- const body = {
23
- response: {
24
- code: 0,
25
- data: {
26
- imageUrl: `https://y.gtimg.cn/music/photo_new/T002R${size}M000${id}.jpg?max_age=${maxAge}`,
27
- },
28
- },
29
- };
30
- Object.assign(ctx, {
31
- status: 200,
32
- body,
33
- });
34
- };
1
+ /*
2
+ * @Author: Rainy
3
+ * @Date: 2020-05-24 12:12:03
4
+ * @LastEditors: Rainy
5
+ * @LastEditTime: 2020-05-24 12:51:23
6
+ */
7
+
8
+ /**
9
+ * @description 获取图片地址
10
+ * @param {歌曲 mid / pmid, 专辑 albumMID} id
11
+ * @param {string} size 图片大小 default 300x300
12
+ * @param {number} maxAge default 2592000
13
+ */
14
+ module.exports = (ctx, next) => {
15
+ const { id, size = '300x300', maxAge = 2592000 } = ctx.query;
16
+ if (!id) {
17
+ ctx.status = 400;
18
+ ctx.body = {
19
+ response: 'no id~~',
20
+ };
21
+ }
22
+ const body = {
23
+ response: {
24
+ code: 0,
25
+ data: {
26
+ imageUrl: `https://y.gtimg.cn/music/photo_new/T002R${size}M000${id}.jpg?max_age=${maxAge}`,
27
+ },
28
+ },
29
+ };
30
+ Object.assign(ctx, {
31
+ status: 200,
32
+ body,
33
+ });
34
+ };
@@ -1,26 +1,26 @@
1
- const { getLyric } = require('../../module');
2
-
3
- // songmid=003rJSwm3TechU
4
- module.exports = async (ctx, next) => {
5
- const { songmid, isFormat } = ctx.query;
6
- const props = {
7
- method: 'get',
8
- params: {
9
- songmid,
10
- },
11
- option: {},
12
- isFormat,
13
- };
14
- if (songmid) {
15
- const { status, body } = await getLyric(props);
16
- Object.assign(ctx, {
17
- status,
18
- body,
19
- });
20
- } else {
21
- ctx.status = 400;
22
- ctx.body = {
23
- response: 'no songmid',
24
- };
25
- }
26
- };
1
+ const { getLyric } = require('../../module');
2
+
3
+ // songmid=003rJSwm3TechU
4
+ module.exports = async (ctx, next) => {
5
+ const { songmid, isFormat } = ctx.query;
6
+ const props = {
7
+ method: 'get',
8
+ params: {
9
+ songmid,
10
+ },
11
+ option: {},
12
+ isFormat,
13
+ };
14
+ if (songmid) {
15
+ const { status, body } = await getLyric(props);
16
+ Object.assign(ctx, {
17
+ status,
18
+ body,
19
+ });
20
+ } else {
21
+ ctx.status = 400;
22
+ ctx.body = {
23
+ response: 'no songmid',
24
+ };
25
+ }
26
+ };