存档:TS 重构前基线(lx 聚合源 = isolated-vm 加载器,签名方案已移除)
This commit is contained in:
commit
f289df4cd7
124 files changed
+14110
No files matched your search
@@ -0,0 +1,26 @@
|
||||
import { httpFetch } from '../request.js'
|
||||
import { requestMsg } from '../message.js'
|
||||
import { headers, timeout } from '../options.js'
|
||||
import { dnsLookup } from '../utils.js'
|
||||
|
||||
const api_temp = {
|
||||
getMusicUrl(songInfo, type) {
|
||||
const requestObj = httpFetch(`http://tm.tempmusics.tk/url/kw/${songInfo.songmid}/${type}`, {
|
||||
method: 'get',
|
||||
headers,
|
||||
timeout,
|
||||
lookup: dnsLookup,
|
||||
family: 4,
|
||||
})
|
||||
requestObj.promise = requestObj.promise.then(({ statusCode, body }) => {
|
||||
if (statusCode == 429) return Promise.reject(new Error(requestMsg.tooManyRequests))
|
||||
switch (body.code) {
|
||||
case 0: return Promise.resolve({ type, url: body.data })
|
||||
default: return Promise.reject(new Error(body.msg))
|
||||
}
|
||||
})
|
||||
return requestObj
|
||||
},
|
||||
}
|
||||
|
||||
export default api_temp
|
||||
Reference in new issue
Block a user