70 lines
1.4 KiB
TypeScript
70 lines
1.4 KiB
TypeScript
export const txHeaders = {
|
|
'User-Agent': 'QQMusic 14090508(android 12)'
|
|
}
|
|
|
|
export const createTxSearchBody = (str: string, page: number, limit: number) => {
|
|
return {
|
|
comm: {
|
|
ct: '11',
|
|
cv: '14090508',
|
|
v: '14090508',
|
|
tmeAppID: 'qqmusic',
|
|
phonetype: 'EBG-AN10',
|
|
deviceScore: '553.47',
|
|
devicelevel: '50',
|
|
newdevicelevel: '20',
|
|
rom: 'HuaWei/EMOTION/EmotionUI_14.2.0',
|
|
os_ver: '12',
|
|
OpenUDID: '0',
|
|
OpenUDID2: '0',
|
|
QIMEI36: '0',
|
|
udid: '0',
|
|
chid: '0',
|
|
aid: '0',
|
|
oaid: '0',
|
|
taid: '0',
|
|
tid: '0',
|
|
wid: '0',
|
|
uid: '0',
|
|
sid: '0',
|
|
modeSwitch: '6',
|
|
teenMode: '0',
|
|
ui_mode: '2',
|
|
nettype: '1020',
|
|
v4ip: ''
|
|
},
|
|
req: {
|
|
module: 'music.search.SearchCgiService',
|
|
method: 'DoSearchForQQMusicMobile',
|
|
param: {
|
|
search_type: 0,
|
|
query: str,
|
|
page_num: page,
|
|
num_per_page: limit,
|
|
highlight: 0,
|
|
nqc_flag: 0,
|
|
multi_zhida: 0,
|
|
cat: 2,
|
|
grp: 1,
|
|
sin: 0,
|
|
sem: 0
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
export const txRequest = async (url: string, body: any) => {
|
|
try {
|
|
const response = await $fetch(url, {
|
|
method: 'POST',
|
|
headers: txHeaders,
|
|
body,
|
|
responseType: 'json'
|
|
})
|
|
return response
|
|
} catch (error) {
|
|
console.error('TX Request Error:', error)
|
|
throw error
|
|
}
|
|
}
|