forked from MakcRe/KuGouMusicApi
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
150 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// 歌词获取 | ||
import { decodeLyrics, mapToObject } from '../util/util'; | ||
|
||
export const useModule = (params: UseModuleParams, useAxios: UseAxios) => { | ||
const dataMap = new Map(); | ||
dataMap.set('ver', 1); | ||
dataMap.set('client', 'android'); | ||
dataMap.set('id', params?.id); // 歌词id | ||
dataMap.set('accesskey', params?.accesskey); // 歌词key | ||
dataMap.set('fmt', params?.fmt || 'krc'); // 歌词类型 | ||
dataMap.set('charset', 'utf8'); | ||
|
||
return new Promise((resolve, reject) => { | ||
useAxios({ | ||
baseURL: 'https://lyrics.kugou.com', | ||
url: '/download', | ||
method: 'GET', | ||
params: mapToObject(dataMap), | ||
cookie: params?.cookie || {}, | ||
encryptType: 'android', | ||
}).then(res => { | ||
console.log(params?.decode); | ||
if (params?.decode) { | ||
if (res.body?.content) { | ||
res.body['decodeContent'] = params?.fmt == 'lrc' ? Buffer.from(res.body?.content, 'base64').toString() :decodeLyrics(res.body.content); | ||
resolve(res); | ||
return; | ||
} | ||
} | ||
resolve(res); | ||
}).catch(e => reject(e)); | ||
}); | ||
} | ||
|
||
export default useModule; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// 搜索 | ||
import { mapToObject } from '../util/util'; | ||
|
||
export const useModule = (params: UseModuleParams, useAxios: UseAxios) => { | ||
const dataMap = new Map(); | ||
dataMap.set('platform', 'AndroidFilter'); | ||
dataMap.set('keyword', params?.keyword || ''); | ||
dataMap.set('page', params?.page || 1); | ||
dataMap.set('pagesize', params?.pagesize || 30); | ||
dataMap.set('category', 1); | ||
|
||
const type = ['special', 'lyric', 'song', 'album', 'author', 'mv'].includes(params.type) ? params.type : 'song'; | ||
|
||
return useAxios({ | ||
url: `/${type === 'song' ? 'v2' : 'v1'}/search/${type}`, | ||
method: 'GET', | ||
params: mapToObject(dataMap), | ||
encryptType: 'android', | ||
headers: { 'x-router': 'complexsearch.kugou.com' }, | ||
cookie: params?.cookie || {}, | ||
}); | ||
} | ||
|
||
export default useModule; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// 综合搜索 | ||
import { mapToObject } from '../util/util'; | ||
|
||
export const useModule = (params: UseModuleParams, useAxios: UseAxios) => { | ||
const dataMap = new Map(); | ||
dataMap.set('platform', 'AndroidFilter'); | ||
dataMap.set('keyword', params.keyword); | ||
dataMap.set('page', params?.page || 1); | ||
dataMap.set('pagesize', params?.pagesize || 30); | ||
dataMap.set('cursor', 0); | ||
|
||
return useAxios({ | ||
baseURL: 'https://complexsearch.kugou.com', | ||
url: '/v6/search/complex', | ||
method: 'GET', | ||
params: mapToObject(dataMap), | ||
encryptType: 'android', | ||
cookie: params?.cookie || {}, | ||
}); | ||
} | ||
|
||
export default useModule; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// 歌词搜索 | ||
import { mapToObject } from '../util/util'; | ||
|
||
export const useModule = (params: UseModuleParams, useAxios: UseAxios) => { | ||
const dataMap = new Map(); | ||
dataMap.set('album_audio_id', params?.album_audio_id || 0); | ||
dataMap.set('appid', 1005); | ||
dataMap.set('clientver', 11309); | ||
dataMap.set('duration', 0); | ||
dataMap.set('hash', params?.hash || ''); | ||
dataMap.set('keyword', params?.keyword || ''); | ||
dataMap.set('lrctxt', 1); | ||
dataMap.set('man', 'no'); | ||
|
||
return useAxios({ | ||
baseURL: 'https://lyrics.kugou.com', | ||
url: '/v1/search', | ||
method: 'GET', | ||
params: mapToObject(dataMap), | ||
cookie: params?.cookie || {}, | ||
encryptType: 'android', | ||
clearDefaultParams: true, | ||
notSign: true | ||
}); | ||
} | ||
|
||
export default useModule; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters