From 69640076b70b0b20bd081401037f88141b85fb70 Mon Sep 17 00:00:00 2001 From: Folltoshe Date: Wed, 26 Apr 2023 21:25:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0tx=E6=90=9C=E7=B4=A2=E8=81=94?= =?UTF-8?q?=E6=83=B3=E8=AF=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderer/utils/musicSdk/tx/index.js | 2 ++ .../utils/musicSdk/tx/{tipSearch.js => tempSearch.js} | 11 ++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) rename src/renderer/utils/musicSdk/tx/{tipSearch.js => tempSearch.js} (71%) diff --git a/src/renderer/utils/musicSdk/tx/index.js b/src/renderer/utils/musicSdk/tx/index.js index 0c755acf..73b4cdee 100644 --- a/src/renderer/utils/musicSdk/tx/index.js +++ b/src/renderer/utils/musicSdk/tx/index.js @@ -5,8 +5,10 @@ import musicSearch from './musicSearch' import { apis } from '../api-source' import hotSearch from './hotSearch' import comment from './comment' +import tempSearch from './tempSearch' const tx = { + tempSearch, leaderboard, songList, musicSearch, diff --git a/src/renderer/utils/musicSdk/tx/tipSearch.js b/src/renderer/utils/musicSdk/tx/tempSearch.js similarity index 71% rename from src/renderer/utils/musicSdk/tx/tipSearch.js rename to src/renderer/utils/musicSdk/tx/tempSearch.js index 23f397e6..18e67c65 100644 --- a/src/renderer/utils/musicSdk/tx/tipSearch.js +++ b/src/renderer/utils/musicSdk/tx/tempSearch.js @@ -6,11 +6,15 @@ export default { relWord: /RELWORD=(.+)/, }, requestObj: null, + cancelTempSearch() { + if (this.requestObj && this.requestObj.cancelHttp) this.requestObj.cancelHttp() + }, tempSearch(str) { this.cancelTempSearch() - this.requestObj = httpFetch(`https://c.y.qq.com/splcloud/fcgi-bin/smartbox_new.fcg?is_xml=0&format=json&key=${encodeURIComponent(str)}&loginUin=0&hostUin=0&format=json&inCharset=utf8&outCharset=utf-8¬ice=0&platform=yqq&needNewCode=0`, { + this.requestObj = httpFetch(`https://c.y.qq.com/splcloud/fcgi-bin/smartbox_new.fcg?_=1682514997109&cv=4747474&ct=24&format=json&inCharset=utf-8&outCharset=utf-8¬ice=0&platform=yqq.json&needNewCode=1&uin=0&g_tk_new_20200303=5381&g_tk=5381&hostUin=0&is_xml=0&key=${encodeURIComponent(str)}`, { headers: { - Referer: 'https://y.qq.com/portal/player.html', + origin: 'https://y.qq.com/', + referer: 'https://y.qq.com/', }, }) return this.requestObj.promise.then(({ statusCode, body }) => { @@ -21,9 +25,6 @@ export default { handleResult(rawData) { return rawData.map(info => `${info.name} - ${info.singer}`) }, - cancelTempSearch() { - if (this.requestObj && this.requestObj.cancelHttp) this.requestObj.cancelHttp() - }, async search(str) { return this.tempSearch(str).then(result => this.handleResult(result.song.itemlist)) },