@sansenjian/qq-music-api 1.0.6

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 (146) hide show
  1. package/.babelrc +3 -0
  2. package/.dockerignore +5 -0
  3. package/.editorconfig +31 -0
  4. package/.eslintrc.json +17 -0
  5. package/.github/FUNDING.yml +12 -0
  6. package/.github/ISSUE_TEMPLATE/bug_report.md +38 -0
  7. package/.github/ISSUE_TEMPLATE/custom.md +24 -0
  8. package/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
  9. package/.prettierignore +1 -0
  10. package/.prettierrc +9 -0
  11. package/CHANGELOG.md +70 -0
  12. package/Dockerfile +18 -0
  13. package/LICENSE +21 -0
  14. package/QQ/351/237/263/344/271/220-v0.xmind +0 -0
  15. package/QQ/351/237/263/344/271/220-v1.xmind +0 -0
  16. package/README.md +177 -0
  17. package/app.js +75 -0
  18. package/commitlint.config.js +20 -0
  19. package/config/user-info.js +42 -0
  20. package/index.js +1 -0
  21. package/middlewares/koa-cors.js +97 -0
  22. package/module/apis/UCommon/UCommon.js +6 -0
  23. package/module/apis/album/getAlbumInfo.js +33 -0
  24. package/module/apis/comments/getComments.js +35 -0
  25. package/module/apis/digitalAlbum/getDigitalAlbumLists.js +34 -0
  26. package/module/apis/downloadQQMusic.js +41 -0
  27. package/module/apis/music/getLyric.js +41 -0
  28. package/module/apis/mv/getMvByTag.js +35 -0
  29. package/module/apis/radio/getRadioLists.js +38 -0
  30. package/module/apis/rank/getTopLists.js +44 -0
  31. package/module/apis/search/getHotKey.js +35 -0
  32. package/module/apis/search/getSearchByKey.js +45 -0
  33. package/module/apis/search/getSmartbox.js +34 -0
  34. package/module/apis/singers/getSimilarSinger.js +36 -0
  35. package/module/apis/singers/getSingerDesc.js +38 -0
  36. package/module/apis/singers/getSingerMv.js +35 -0
  37. package/module/apis/singers/getSingerStarNum.js +36 -0
  38. package/module/apis/songLists/songListCategories.js +33 -0
  39. package/module/apis/songLists/songListDetail.js +38 -0
  40. package/module/apis/songLists/songLists.js +41 -0
  41. package/module/apis/u_common.js +16 -0
  42. package/module/apis/user/checkQQLoginQr.js +86 -0
  43. package/module/apis/user/getQQLoginQr.js +11 -0
  44. package/module/apis/y_common.js +14 -0
  45. package/module/config.js +31 -0
  46. package/module/index.js +82 -0
  47. package/music.png +0 -0
  48. package/package.json +83 -0
  49. package/public/index.html +48 -0
  50. package/routers/context/batchGetSongInfo.js +59 -0
  51. package/routers/context/batchGetSongLists.js +50 -0
  52. package/routers/context/checkQQLoginQr.js +15 -0
  53. package/routers/context/cookies.js +36 -0
  54. package/routers/context/getAlbumInfo.js +27 -0
  55. package/routers/context/getComments.js +51 -0
  56. package/routers/context/getDigitalAlbumLists.js +14 -0
  57. package/routers/context/getDownloadQQMusic.js +14 -0
  58. package/routers/context/getHotkey.js +14 -0
  59. package/routers/context/getImageUrl.js +34 -0
  60. package/routers/context/getLyric.js +26 -0
  61. package/routers/context/getMusicPlay.js +112 -0
  62. package/routers/context/getMv.js +56 -0
  63. package/routers/context/getMvByTag.js +15 -0
  64. package/routers/context/getMvPlay.js +118 -0
  65. package/routers/context/getNewDisks.js +51 -0
  66. package/routers/context/getQQLoginQr.js +12 -0
  67. package/routers/context/getRadioLists.js +14 -0
  68. package/routers/context/getRanks.js +86 -0
  69. package/routers/context/getRecommend.js +86 -0
  70. package/routers/context/getSearchByKey.js +32 -0
  71. package/routers/context/getSimilarSinger.js +25 -0
  72. package/routers/context/getSingerAlbum.js +52 -0
  73. package/routers/context/getSingerDesc.js +25 -0
  74. package/routers/context/getSingerHotsong.js +52 -0
  75. package/routers/context/getSingerList.js +52 -0
  76. package/routers/context/getSingerMv.js +32 -0
  77. package/routers/context/getSingerStarNum.js +24 -0
  78. package/routers/context/getSmartbox.js +24 -0
  79. package/routers/context/getSongInfo.js +49 -0
  80. package/routers/context/getSongListCategories.js +22 -0
  81. package/routers/context/getSongListDetail.js +25 -0
  82. package/routers/context/getSongLists.js +32 -0
  83. package/routers/context/getTicketInfo.js +45 -0
  84. package/routers/context/getTopLists.js +15 -0
  85. package/routers/context/index.js +74 -0
  86. package/routers/router.js +112 -0
  87. package/screenshot/album-image.png +0 -0
  88. package/screenshot/batchGetSongInfo.png +0 -0
  89. package/screenshot/batchGetSongLists.png +0 -0
  90. package/screenshot/downloadQQMusic.png +0 -0
  91. package/screenshot/get-album-image.png +0 -0
  92. package/screenshot/get-play-all-data.png +0 -0
  93. package/screenshot/get-song-album-id.png +0 -0
  94. package/screenshot/get-song-id.png +0 -0
  95. package/screenshot/get-song-image.png +0 -0
  96. package/screenshot/getAlbumInfo.png +0 -0
  97. package/screenshot/getComments-id.png +0 -0
  98. package/screenshot/getComments-param.png +0 -0
  99. package/screenshot/getComments.png +0 -0
  100. package/screenshot/getDigitalAlbumLists.png +0 -0
  101. package/screenshot/getLyric-parse.png +0 -0
  102. package/screenshot/getLyric.png +0 -0
  103. package/screenshot/getMusicPlay.png +0 -0
  104. package/screenshot/getMv.png +0 -0
  105. package/screenshot/getMvByTag.png +0 -0
  106. package/screenshot/getMvPlay.png +0 -0
  107. package/screenshot/getNewDisks.png +0 -0
  108. package/screenshot/getRadioLists.png +0 -0
  109. package/screenshot/getRanks.png +0 -0
  110. package/screenshot/getRecommend.png +0 -0
  111. package/screenshot/getSearchByKey.png +0 -0
  112. package/screenshot/getSimilarSinger.png +0 -0
  113. package/screenshot/getSingerAlbum.png +0 -0
  114. package/screenshot/getSingerDesc.png +0 -0
  115. package/screenshot/getSingerHotsong.png +0 -0
  116. package/screenshot/getSingerList.png +0 -0
  117. package/screenshot/getSingerMv-default.png +0 -0
  118. package/screenshot/getSingerMv-listen.png +0 -0
  119. package/screenshot/getSingerMv-time.png +0 -0
  120. package/screenshot/getSingerStarNum.png +0 -0
  121. package/screenshot/getSmartbox.png +0 -0
  122. package/screenshot/getSongInfo.png +0 -0
  123. package/screenshot/getSongListCategories.png +0 -0
  124. package/screenshot/getSongListDetail.png +0 -0
  125. package/screenshot/getSongLists-params.png +0 -0
  126. package/screenshot/getSongLists.png +0 -0
  127. package/screenshot/getTicketInfo.png +0 -0
  128. package/screenshot/getTopLists.png +0 -0
  129. package/screenshot/gethotkey.png +0 -0
  130. package/screenshot/just-get-play-url.png +0 -0
  131. package/screenshot/musicPlay.png +0 -0
  132. package/screenshot/new-feature-error-tips.png +0 -0
  133. package/screenshot/normalize-cookie.png +0 -0
  134. package/screenshot/qq-music-v0.png +0 -0
  135. package/screenshot/qq-music.png +0 -0
  136. package/screenshot/song-image.png +0 -0
  137. package/screenshot/song-quality-128.png +0 -0
  138. package/screenshot/song-quality-m4a.png +0 -0
  139. package/scripts/build-images.js +36 -0
  140. package/scripts/commit-push.sh +103 -0
  141. package/util/colors.js +16 -0
  142. package/util/cookie.js +22 -0
  143. package/util/loginUtils.js +23 -0
  144. package/util/lyricParse.js +64 -0
  145. package/util/request.js +57 -0
  146. package/vercel.json +15 -0
@@ -0,0 +1,112 @@
1
+ const Router = require('koa-router');
2
+ const router = new Router();
3
+ const context = require('./context');
4
+
5
+ // cookies
6
+ router.get('/user/getCookie', context.getCookie);
7
+ router.get('/user/setCookie', context.setCookie);
8
+
9
+ // downloadQQMusic
10
+ router.get('/downloadQQMusic', context.getDownloadQQMusic);
11
+
12
+ router.get('/getHotkey', context.getHotKey);
13
+
14
+ router.get('/getSearchByKey/:key?/:limit?/:page?/:catZhida?', context.getSearchByKey);
15
+
16
+ // search smartbox
17
+ router.get('/getSmartbox/:key?', context.getSmartbox);
18
+
19
+ // 1
20
+ router.get('/getSongListCategories', context.getSongListCategories);
21
+
22
+ router.get('/getSongLists/:page?/:limit?/:categoryId?/:sortId?', context.getSongLists);
23
+
24
+ router.post('/batchGetSongLists', context.batchGetSongLists);
25
+
26
+ // getSongInfo
27
+ router.get('/getSongInfo/:songmid?/:songid?', context.getSongInfo);
28
+ router.post('/batchGetSongInfo', context.batchGetSongInfo);
29
+
30
+ // 4
31
+ // disstid=7011264340
32
+ router.get('/getSongListDetail/:disstid?', context.getSongListDetail);
33
+
34
+ // newDisk
35
+ router.get('/getNewDisks/:page?/:limit?', context.getNewDisks);
36
+
37
+ // getMvByTag
38
+ router.get('/getMvByTag', context.getMvByTag);
39
+
40
+ // MV
41
+ // area_id=15&version_id=7
42
+ router.get('/getMv/:area_id?/:version_id?/:limit?/:page?', context.getMv);
43
+
44
+ // getSingerList
45
+ router.get('/getSingerList/:area?/:sex?/:genre?/:index?/:page?', context.getSingerList);
46
+
47
+ // getSimilarSinger
48
+ // singermid=0025NhlN2yWrP4
49
+ router.get('/getSimilarSinger/:singermid?', context.getSimilarSinger);
50
+
51
+ // getSingerAlbum
52
+ // singermid=0025NhlN2yWrP4
53
+ router.get('/getSingerAlbum/:singermid?/:limit?/:page?', context.getSingerAlbum);
54
+
55
+ router.get('/getSingerHotsong/:singermid?/:limit?/:page?', context.getSingerHotsong);
56
+
57
+ /**
58
+ * @description: getSingerMv
59
+ * @param order: time(fan upload) || listen(singer all)
60
+ */
61
+ router.get('/getSingerMv/:singermid?/:limit?/:order?', context.getSingerMv);
62
+
63
+ router.get('/getSingerDesc/:singermid?', context.getSingerDesc);
64
+
65
+ router.get('/getSingerStarNum/:singermid?', context.getSingerStarNum);
66
+
67
+ // radio
68
+ router.get('/getRadioLists', context.getRadioLists);
69
+
70
+ // DigitalAlbum
71
+ router.get('/getDigitalAlbumLists', context.getDigitalAlbumLists);
72
+
73
+ // music
74
+ // getLyric
75
+ // songmid=003rJSwm3TechU
76
+ router.get('/getLyric/:songmid?/:isFormat?', context.getLyric);
77
+
78
+ // songmid=003rJSwm3TechU
79
+ router.get('/getMusicPlay/:songmid?', context.getMusicPlay);
80
+
81
+ // album
82
+ // albummid=0016l2F430zMux
83
+ router.get('/getAlbumInfo/:albummid?', context.getAlbumInfo);
84
+
85
+ router.get(
86
+ '/getComments/:id?/:rootcommentid?/:cid?/:pagesize?/:pagenum?/:cmd?/:reqtype?/:biztype?',
87
+ context.getComments,
88
+ );
89
+
90
+ // recommend
91
+ router.get('/getRecommend', context.getRecommend);
92
+
93
+ // mv play
94
+ router.get('/getMvPlay/:vid?', context.getMvPlay);
95
+
96
+ // rankList: getTopLists
97
+ router.get('/getTopLists', context.getTopLists);
98
+
99
+ // ranks
100
+ router.get('/getRanks/:topId?/:limit?/:page?', context.getRanks);
101
+
102
+ // ticket
103
+ router.get('/getTicketInfo', context.getTicketInfo);
104
+
105
+ // getImageUrl
106
+ router.get('/getImageUrl', context.getImageUrl);
107
+
108
+ // getQQLoginQr
109
+ router.get('/user/getQQLoginQr', context.getQQLoginQr);
110
+ router.post('/user/checkQQLoginQr', context.checkQQLoginQr);
111
+
112
+ module.exports = router;
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,36 @@
1
+ const {exec} = require('child_process');
2
+ const { version, author } = require('../package.json');
3
+
4
+ const isLocal = process.argv[2] === 'local';
5
+
6
+ console.log(`------------ ${isLocal ? 'Local' : 'Remote'} Docker Build Images Start ------------\n`);
7
+
8
+ // const run = 'docker run -d --name qq-music-api -p 3200:3200 qq-music-api'
9
+ const image = `${isLocal ? '' : `${author.toLowerCase()}/`}qq-music-api:${version}`
10
+ const cmd = isLocal
11
+ ? `docker build -t ${image} .`
12
+ : `docker image tag qq-music-api:${version} ${image}`;
13
+
14
+ console.log('cmd:', cmd, '\n');
15
+
16
+ exec(cmd, {}, (err, stdout, stderr) => {
17
+ if (err) {
18
+ console.log(err);
19
+ return;
20
+ }
21
+ console.log(stdout, stderr);
22
+ console.log(`------------ ${isLocal ? 'Local' : 'Remote'} Docker Build Images End ------------\n`);
23
+ if (!isLocal) {
24
+ const pushCmd = `docker image push ${image}`;
25
+ console.log('pushCmd:', pushCmd, '\n');
26
+ console.log(`------------ ${isLocal ? 'Local' : 'Remote'} Docker Push Images Start ------------\n`);
27
+ exec(pushCmd, {}, (err, stdout, stderr) => {
28
+ if (err) {
29
+ console.log(err);
30
+ return;
31
+ }
32
+ console.log(stdout, stderr);
33
+ console.log(`------------ ${isLocal ? 'Local' : 'Remote'} Docker Push Images End ------------\n`);
34
+ });
35
+ }
36
+ });
@@ -0,0 +1,103 @@
1
+ ###
2
+ # @Author: Rainy
3
+ # @Date: 2020-05-24 13:05:40
4
+ # @LastEditors: Rainy
5
+ # @LastEditTime: 2020-05-24 13:06:02
6
+ ###
7
+
8
+ #!/usr/bin/env bash
9
+
10
+ echo "------------ commit push shell run ------------"
11
+
12
+ read -p "Input your commit msg (*): " msg
13
+ read -p "Amend commit(Y, y, default: N): " amend
14
+ read -p "Need pull current branch(Y, y, default: N): " pull
15
+
16
+ len=120
17
+ curBranch=$(git branch | awk '/\*/ { print $2; }')
18
+
19
+ # start reg
20
+ msgRegLower='^\s*(feat|fix|docs|style|chore|build|ci|perf|refactor|revert|test|temp|update)\s*\:*\s*'
21
+ msgRegUpper='^\s*(Feat|Fix|Docs|Style|Chore|Build|Ci|Perf|Refactor|Revert|Test|Temp|Update)\s*\:*\s*'
22
+
23
+ # 另一种获取当前 branch_name 的方法
24
+ # git symbolic-ref --short HEAD
25
+
26
+ echo "Log: Cureren branch is ${curBranch}"
27
+
28
+ if [[ $pull = "Y" || $pull = "y" ]];then
29
+
30
+ read -p "Need pull branch(default: current branch, eg: master): " branch
31
+
32
+ fi
33
+
34
+ if [ -n "$msg" ];then
35
+
36
+ echo "Log: Commit msg: $msg"
37
+
38
+ if [ ${#msg} -gt $len ];then
39
+ echo "Error: msg length must less than $len"
40
+ exit 1
41
+ fi
42
+
43
+ if [[ "$msg" =~ $msgRegLower || "$msg" =~ $msgRegUpper ]];then
44
+
45
+ git add .
46
+
47
+ if [[ $amend = "Y" || $amend = "y" ]];then
48
+ echo "Log: Amending message commit"
49
+ git commit --amend -m "$msg" || exit 1
50
+ else
51
+ echo "Log: Commiting"
52
+ git commit -m "$msg" || exit 1
53
+ fi
54
+
55
+ if [[ $pull = "Y" || $pull = "y" ]];then
56
+
57
+ if [ -n "$branch" ];then
58
+
59
+ echo "Log: Pulling branch is $branch"
60
+
61
+ fi
62
+
63
+ branch=${curBranch}
64
+
65
+ echo "Log: Pulling ${branch} from remote"
66
+ git pull origin ${branch} || exit 1
67
+
68
+ else
69
+
70
+ branch=${curBranch}
71
+
72
+ echo "Log: Current branch is $branch"
73
+
74
+ echo "Log: Jump pull branch"
75
+
76
+ fi
77
+
78
+ read -p "Auto Push(Y, y, default: Y): " push
79
+
80
+ if [ -z "${push}" ];then
81
+ push='Y'
82
+ fi
83
+
84
+ if [[ $push = "Y" || $push = "y" ]];then
85
+
86
+ echo "Log: Pushing"
87
+
88
+ git push origin ${branch} || exit 1
89
+ fi
90
+
91
+ echo "------------ commit push shell end ------------"
92
+
93
+ else
94
+ echo "Error: Commit message start type must be one of [feat, fix, docs, style, chore, build, ci, perf, refactor, revert, test, temp, Feat, Fix, Docs, Style, Chore, Build, Ci, Perf, Refactor, Revert, Test, Temp]"
95
+ exit 1
96
+ fi
97
+
98
+ else
99
+
100
+ echo "Please input commit msg"
101
+ exit 1
102
+
103
+ fi
package/util/colors.js ADDED
@@ -0,0 +1,16 @@
1
+ const colors = require('colors');
2
+
3
+ colors.setTheme({
4
+ silly: 'rainbow',
5
+ input: 'grey',
6
+ verbose: 'cyan',
7
+ prompt: 'white',
8
+ info: 'green',
9
+ data: 'grey',
10
+ help: 'cyan',
11
+ warn: 'yellow',
12
+ debug: 'blue',
13
+ error: 'red',
14
+ });
15
+
16
+ module.exports = colors;
package/util/cookie.js ADDED
@@ -0,0 +1,22 @@
1
+ module.exports = () => async (ctx, next) => {
2
+ if (global.userInfo.cookie) {
3
+ ctx.request.cookie = global.userInfo.cookie;
4
+ }
5
+
6
+ const cookieHeader = ctx.request.headers;
7
+
8
+ if (cookieHeader) {
9
+ global.userInfo.cookieList.forEach(cookie => {
10
+ const [key, value = ''] = cookie.split('=');
11
+
12
+ if (value) {
13
+ ctx.cookies.set(key, value.trim(), {
14
+ // maxAge: 24 * 60 * 60 * 1000,
15
+ overwirte: true,
16
+ });
17
+ }
18
+ });
19
+ }
20
+
21
+ await next();
22
+ };
@@ -0,0 +1,23 @@
1
+ const hash33 = (t) => {
2
+ for (var e = 0, n = 0, o = t.length; n < o; ++n)
3
+ e += (e << 5) + t.charCodeAt(n);
4
+ return 2147483647 & e
5
+ };
6
+
7
+ const getGtk = (p_skey) => {
8
+ var str = p_skey, hash = 5381;
9
+ for (var i = 0, len = str.length; i < len; ++i) {
10
+ hash += (hash << 5) + str.charCodeAt(i);
11
+ }
12
+ return hash & 0x7fffffff;
13
+ };
14
+
15
+ const getGuid = () => {
16
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
17
+ var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
18
+ return v.toString(16);
19
+ }).toUpperCase();
20
+ };
21
+
22
+
23
+ module.exports = { hash33, getGtk, getGuid };
@@ -0,0 +1,64 @@
1
+ // [01:27.96]
2
+ const timeExp = /\[(\d{2,}):(\d{2})(?:\.(\d{2,3}))?]/g;
3
+
4
+ const TAGREGMAP = {
5
+ title: 'ti',
6
+ artist: 'ar',
7
+ album: 'al',
8
+ offset: 'offset',
9
+ by: 'by',
10
+ };
11
+
12
+ class Lyric {
13
+ constructor(lyric) {
14
+ this.lyric = lyric;
15
+ this.tags = {};
16
+ this.lines = [];
17
+
18
+ this._init();
19
+ }
20
+
21
+ _init() {
22
+ this._initTag();
23
+
24
+ this._initLines();
25
+ }
26
+
27
+ _initTag() {
28
+ for (let tag in TAGREGMAP) {
29
+ const matches = this.lyric.match(new RegExp(`\\[${TAGREGMAP[tag]}:([^\\]]*)]`, 'i'));
30
+ this.tags[tag] = (matches && matches[1]) || '';
31
+ }
32
+ }
33
+
34
+ _initLines() {
35
+ const lines = this.lyric.split('\n');
36
+ for (let i = 0; i < lines.length; i++) {
37
+ const line = lines[i];
38
+ let result = timeExp.exec(line);
39
+ if (result) {
40
+ const txt = line.replace(timeExp, '').trim();
41
+ const time = result[1] * 60 * 1000 + result[2] * 1000 + (result[3] || 0) * 10;
42
+ if (txt) {
43
+ this.lines.push({
44
+ time,
45
+ txt,
46
+ });
47
+ }
48
+ }
49
+ }
50
+
51
+ this.lines.sort((a, b) => {
52
+ return a.time - b.time;
53
+ });
54
+ }
55
+ }
56
+
57
+ function lyricParse(lyricString) {
58
+ return new Lyric(lyricString);
59
+ }
60
+
61
+ module.exports = {
62
+ Lyric,
63
+ lyricParse,
64
+ };
@@ -0,0 +1,57 @@
1
+ const axios = require('axios');
2
+ require('../util/colors');
3
+
4
+ // `withCredentials` 表示跨域请求时是否需要使用凭证
5
+ axios.defaults.withCredentials = true;
6
+ axios.defaults.timeout = 10000;
7
+ axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8;text/plain;';
8
+ axios.defaults.responseType = 'json;text/plain;charset=utf-8;';
9
+
10
+ const setHeaders = headers => {
11
+ return {
12
+ ...headers,
13
+ cookies: global.userInfo.cookie
14
+ };
15
+ };
16
+
17
+ let yURL = 'https://y.qq.com';
18
+ let cURL = 'https://c.y.qq.com';
19
+ // let uURL = 'https:/u.y.qq.com/cgi-bin/musicu.fcg';
20
+
21
+ function request(url, method = 'GET', options = {}, isUUrl = 'c') {
22
+ let baseURL = '';
23
+ switch (isUUrl) {
24
+ case 'y':
25
+ baseURL = yURL + url;
26
+ break;
27
+ case 'u':
28
+ baseURL = url;
29
+ break;
30
+ case 'c':
31
+ baseURL = cURL + url;
32
+ break;
33
+ default:
34
+ baseURL = cURL + url;
35
+ break;
36
+ }
37
+
38
+ options = Object.assign(options, {
39
+ headers: setHeaders(options.headers || {}),
40
+ });
41
+
42
+ return axios[method](baseURL, options).then(
43
+ response => {
44
+ if (!response) {
45
+ throw Error('response is null');
46
+ }
47
+ console.log(`${url} request success`.info);
48
+ return response;
49
+ },
50
+ error => {
51
+ console.log(`${url} request error`.error);
52
+ throw error;
53
+ },
54
+ );
55
+ }
56
+
57
+ module.exports = request;
package/vercel.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "version": 2,
3
+ "builds": [
4
+ {
5
+ "src": "./index.js",
6
+ "use": "@vercel/node"
7
+ }
8
+ ],
9
+ "routes": [
10
+ {
11
+ "src": "/(.*)",
12
+ "dest": "/"
13
+ }
14
+ ]
15
+ }