lyswhut/lx-music-desktop · error · Error
获取热搜词失败
Error message
获取热搜词失败
What it means
Kugou hot-search fetcher in kg/hotSearch.js:22. GETs gateway.kugou.com /api/v3/search/hot_tab with a STATIC signature (ee44edb9...) and STATIC headers including clienttime: 1584257267 (a March-2020 timestamp) and fixed dfid/mid. Requires HTTP 200 and body.errcode === 0; otherwise throws '获取热搜词失败'.
Source
Thrown at src/renderer/utils/musicSdk/kg/hotSearch.js:22
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('http://gateway.kugou.com/api/v3/search/hot_tab?signature=ee44edb9d7155821412d220bcaf509dd&appid=1005&clientver=10026&plat=0', {
method: 'get',
headers: {
dfid: '1ssiv93oVqMp27cirf2CvoF1',
mid: '156798703528610303473757548878786007104',
clienttime: 1584257267,
'x-router': 'msearch.kugou.com',
'user-agent': 'Android9-AndroidPhone-10020-130-0-searchrecommendprotocol-wifi',
'kg-rc': 1,
},
})
const { body, statusCode } = await _requestObj.promise
if (statusCode != 200 || body.errcode !== 0) throw new Error('获取热搜词失败')
// console.log(body, statusCode)
return { source: 'kg', list: this.filterList(body.data.list) }
},
filterList(rawList) {
const list = []
rawList.forEach(item => {
item.keywords.map(k => list.push(decodeName(k.keyword)))
})
return list
},
}
View on GitHub (pinned to 9c364b482e)
Solutions
- Regenerate the signature dynamically per request instead of using the constant 'ee44edb9d7155821412d220bcaf509dd'.
- Refresh the clienttime header to a current epoch value and rotate dfid/mid if they are flagged.
- Confirm /api/v3/search/hot_tab is still the active endpoint; update if Kugou moved it.
- Degrade to an empty hot-search list in the UI on rejection.
Example fix
// before
const _requestObj = httpFetch('http://gateway.kugou.com/api/v3/search/hot_tab?signature=ee44edb9d7155821412d220bcaf509dd&appid=1005&clientver=10026&plat=0', {
method: 'get',
headers: { dfid: '1ssiv93oVqMp27cirf2CvoF1', mid: '15679...', clienttime: 1584257267, ... },
})
// after - compute signature + clienttime dynamically
const clienttime = Math.floor(Date.now() / 1000)
const params = `appid=1005&clientver=10026&plat=0&clienttime=${clienttime}`
const signature = signatureParams(params)
const _requestObj = httpFetch(`http://gateway.kugou.com/api/v3/search/hot_tab?${params}&signature=${signature}`, { method: 'get', headers: { ... } }) Defensive patterns
Strategy: fallback
Validate before calling
// best-effort liveness check of the gateway before the real call
async function kgGatewayAlive() {
try {
const { statusCode } = await httpFetch('http://gateway.kugou.com/', { method: 'head', timeout: 3000 }).promise
return statusCode >= 200 && statusCode < 500
} catch { return false }
} Type guard
const isKgHotSearchSuccess = (body) => body != null && typeof body === 'object' && body.errcode === 0 && body.data != null && Array.isArray(body.data.list)
Try / catch
async function loadKgHotSearch() {
try {
return await kgHotSearch.getList()
} catch (e) {
return { source: 'kg', list: [], error: e.message } // empty hot list in UI
}
} Prevention
- Do NOT rely on the hardcoded signature (ee44...) and 2020 clienttime — regenerate them dynamically.
- Rotate the dfid/mid headers if Kugou flags the static pair.
- Degrade to an empty hot-search list in the UI when the gateway rejects.
When it happens
Trigger: Non-200 or errcode != 0 — most likely because the hardcoded static signature and the 2020-era clienttime no longer validate against Kugou's gateway, or the fixed dfid/mid has been banned. Also fires on plain network failure.
Common situations: Kugou rotated its signature requirement so the constant no longer works; the static clienttime is too old and rejected; the dfid/mid pair flagged for abuse; the hot_tab endpoint deprecated.
Related errors
AI-assisted analysis of lyswhut/lx-music-desktop@9c364b482e (2026-08-12).
Data as JSON: /api/errors/1c4044669fd193ed.
Report an issue: GitHub.