更新音源API (#1352)
* 更新API --------- Co-authored-by: lyswhut <lyswhut@qq.com>
This commit is contained in:
@@ -1,13 +1,12 @@
|
||||
import { httpFetch } from '../../request'
|
||||
|
||||
|
||||
export default {
|
||||
regExps: {
|
||||
relWord: /RELWORD=(.+)/,
|
||||
},
|
||||
// regExps: {
|
||||
// relWord: /RELWORD=(.+)/,
|
||||
// },
|
||||
requestObj: null,
|
||||
tempSearch(str) {
|
||||
this.cancelTempSearch()
|
||||
tipSearch(str) {
|
||||
this.cancelTipSearch()
|
||||
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`, {
|
||||
headers: {
|
||||
Referer: 'https://y.qq.com/portal/player.html',
|
||||
@@ -21,10 +20,10 @@ export default {
|
||||
handleResult(rawData) {
|
||||
return rawData.map(info => `${info.name} - ${info.singer}`)
|
||||
},
|
||||
cancelTempSearch() {
|
||||
cancelTipSearch() {
|
||||
if (this.requestObj && this.requestObj.cancelHttp) this.requestObj.cancelHttp()
|
||||
},
|
||||
async search(str) {
|
||||
return this.tempSearch(str).then(result => this.handleResult(result.song.itemlist))
|
||||
return this.tipSearch(str).then(result => this.handleResult(result.song.itemlist))
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user