新增热搜词、历史搜索记录
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import { httpFetch } from '../../request'
|
||||
|
||||
export default {
|
||||
_requestObj: null,
|
||||
async getList(retryNum = 0) {
|
||||
if (this._requestObj) this._requestObj.cancelHttp()
|
||||
if (retryNum > 2) return Promise.reject(new Error('try max num'))
|
||||
|
||||
const _requestObj = httpFetch('https://c.y.qq.com/splcloud/fcgi-bin/gethotkey.fcg', {
|
||||
method: 'get',
|
||||
headers: {
|
||||
Referer: 'https://y.qq.com/portal/player.html',
|
||||
},
|
||||
})
|
||||
const { body, statusCode } = await _requestObj.promise
|
||||
if (statusCode != 200 || body.code !== 0) throw new Error('获取热搜词失败')
|
||||
// console.log(body)
|
||||
return { source: 'tx', list: this.filterList(body.data.hotkey) }
|
||||
},
|
||||
filterList(rawList) {
|
||||
return rawList.map(item => item.k)
|
||||
},
|
||||
}
|
||||
@@ -3,11 +3,13 @@ import lyric from './lyric'
|
||||
import songList from './songList'
|
||||
import musicSearch from './musicSearch'
|
||||
import api_source from '../api-source'
|
||||
import hotSearch from './hotSearch'
|
||||
|
||||
const tx = {
|
||||
leaderboard,
|
||||
songList,
|
||||
musicSearch,
|
||||
hotSearch,
|
||||
|
||||
getMusicUrl(songInfo, type) {
|
||||
return api_source('tx').getMusicUrl(songInfo, type)
|
||||
|
||||
Reference in New Issue
Block a user