lyswhut/lx-music-desktop · warning · Error

获取热搜词失败

Error message

获取热搜词失败

What it means

Thrown by Kuwo's hotSearch.getList when the hot search word endpoint at http://hotword.kuwo.cn/hotword.s returns a non-200 HTTP status or body.status is not strictly 'ok'. This is the only error among the group that uses strict equality (!==) for the status field check, and it checks a different field name (body.status instead of body.code). Has a retry guard (retryNum > 2) that fires first.

Source

Thrown at src/renderer/utils/musicSdk/kw/hotSearch.js:15

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('http://hotword.kuwo.cn/hotword.s?prod=kwplayer_ar_9.3.0.1&corp=kuwo&newver=2&vipver=9.3.0.1&source=kwplayer_ar_9.3.0.1_40.apk&p2p=1&notrace=0&uid=0&plat=kwplayer_ar&rformat=json&encoding=utf8&tabid=1', {
      headers: {
        'User-Agent': 'Dalvik/2.1.0 (Linux; U; Android 9;)',
      },
    })
    const { body, statusCode } = await _requestObj.promise
    if (statusCode != 200 || body.status !== 'ok') throw new Error('获取热搜词失败')
    // console.log(body, statusCode)
    return { source: 'kw', list: this.filterList(body.tagvalue) }
  },
  filterList(rawList) {
    return rawList.map(item => item.key)
  },
}

View on GitHub (pinned to 9c364b482e)

Solutions

  1. Log body and statusCode before the throw to see if the issue is transport or contract.
  2. Update the prod/source version query parameters to match the latest Kuwo APK.
  3. Retry by calling getList(retryNum + 1) since it supports bounded retries.
  4. Fall back to another provider's hot search if Kuwo remains unavailable.

Example fix

// before
if (statusCode != 200 || body.status !== 'ok') throw new Error('获取热搜词失败')

// after
if (statusCode != 200 || !body || body.status !== 'ok') {
  console.warn('kw hotSearch failed', { statusCode, status: body?.status })
  if (retryNum < 2) return this.getList(retryNum + 1)
  throw new Error('获取热搜词失败')
}
Defensive patterns

Strategy: retry

Type guard

function isKwHotSearchResponse(body) {
  return body != null && typeof body === 'object' && body.status === 'ok' && Array.isArray(body.tagvalue)
}

Try / catch

try {
  const result = await kwHotSearch.getList()
} catch (err) {
  if (err.message === '获取热搜词失败') {
    console.warn('Kuwo hot search unavailable, falling back')
    return { source: 'kw', list: [] }
  }
  throw err
}

Prevention

When it happens

Trigger: Calling getList() when hotword.kuwo.cn is unreachable or returns an error status. The endpoint has no query parameters besides fixed app-version strings, so Kuwo deprecating or changing the response format (body.status no longer 'ok') triggers this. The retryNum guard fires before this throw if getList has already been retried 3 times.

Common situations: Kuwo sunsets the hotword.s endpoint or changes the prod/version query params. ISP blocks hotword.kuwo.cn. The app runs in a region where Kuwo is geo-blocked.

Related errors


AI-assisted analysis of lyswhut/lx-music-desktop@9c364b482e (2026-08-12). Data as JSON: /api/errors/059c597dfa58e5e8. Report an issue: GitHub.