Skip to content

Instantly share code, notes, and snippets.

@UnluckyNinja
Created July 19, 2023 16:38
Show Gist options
  • Save UnluckyNinja/cd8d04d780485e9ce730f2e895018026 to your computer and use it in GitHub Desktop.
Save UnluckyNinja/cd8d04d780485e9ce730f2e895018026 to your computer and use it in GitHub Desktop.
从FF14商城查找对应商品信息
let list = [
]
for (let i = 0; i < list.length; i++){
const name = list[i]
const result = await (await fetch(`https://sqmallservice.u.sdo.com/api/ps/product/list?merchantId=1&page=1&pageSize=40&categoryId=&tagId=&order=0&keyword=${encodeURIComponent(name)}&categoryType=0`, {
"headers": {
"accept": "application/json, text/javascript, */*; q=0.01",
"accept-language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7,zh-TW;q=0.6,en-GB;q=0.5,ja;q=0.4",
"qu-deploy-platform": "1",
"qu-hardware-platform": "3",
"qu-merchant-id": "1",
"qu-software-platform": "1",
"qu-web-host": "qu.sdo.com",
"sec-ch-ua": "\"Not.A/Brand\";v=\"8\", \"Chromium\";v=\"114\", \"Microsoft Edge\";v=\"114\"",
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": "\"Windows\"",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-site"
},
"referrer": "https://qu.sdo.com/",
"referrerPolicy": "strict-origin-when-cross-origin",
"body": null,
"method": "GET",
"mode": "cors",
"credentials": "include"
})).json()
let code = result.resultMsg
let count = result.data.totalCount
if(code !== 'SUCCESS' || count !== 1){
console.error(`!!! There isn't an exact result when searching for "${name}"`)
console.error(`at https://qu.sdo.com/tools-shop?merchantId=1&keyword=${encodeURIComponent(name)}`)
console.error(`exited`)
break
}
let price = result.data.productList[0].price
console.log(price)
await (new Promise(resolve=>setTimeout(resolve, 500)))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment