feat(album): 新增 QQ 音乐(tx)专辑支持
This commit is contained in:
1 parent
b06769dbbd
commit
0f2585e5bd
7 files changed
+88
-33
No files matched your search
@@ -15,3 +15,31 @@ export const signRequest = async(data) => {
|
||||
body: data,
|
||||
}).promise
|
||||
}
|
||||
|
||||
/**
|
||||
* musicu.fcg 通用请求(comm 参数对齐榜单模块的可用配置;
|
||||
* musichallSinger/musichallAlbum 的部分详情接口在该通道已停用,见各模块说明)
|
||||
*/
|
||||
export const createMusicuFetch = async(data, retryNum = 0) => {
|
||||
if (retryNum > 2) throw new Error('try max num')
|
||||
|
||||
let result
|
||||
try {
|
||||
result = await httpFetch('https://u.y.qq.com/cgi-bin/musicu.fcg', {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)',
|
||||
},
|
||||
body: {
|
||||
comm: { uin: 0, format: 'json', ct: 20, cv: 1859 },
|
||||
...data,
|
||||
},
|
||||
}).promise
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
return createMusicuFetch(data, ++retryNum)
|
||||
}
|
||||
if (result.statusCode !== 200 || result.body.code != 0) return createMusicuFetch(data, ++retryNum)
|
||||
|
||||
return result.body
|
||||
}
|
||||
Reference in new issue
Block a user