{"record":{"id":"bbf62564adf6a0a4","repo":"lyswhut/lx-music-desktop","slug":"error-bbf625","errorCode":null,"errorMessage":"获取评论失败","messagePattern":"获取评论失败","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/renderer/utils/musicSdk/tx/comment.js","lineNumber":114,"sourceCode":"      method: 'POST',\n      headers: {\n        'User-Agent': 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)',\n      },\n      form: {\n        uin: '0',\n        format: 'json',\n        cid: '205360772',\n        reqtype: '2',\n        biztype: '1',\n        topid: songId,\n        cmd: '8',\n        needmusiccrit: '1',\n        pagenum: page - 1,\n        pagesize: limit,\n      },\n    })\n    const { body, statusCode } = await _requestObj.promise\n    if (statusCode != 200 || body.code !== 0) throw new Error('获取评论失败')\n    // console.log(body, statusCode)\n    const comment = body.comment\n    return {\n      source: 'tx',\n      comments: this.filterNewComment(comment.commentlist),\n      total: comment.commenttotal,\n      page,\n      limit,\n      maxPage: Math.ceil(comment.commenttotal / limit) || 1,\n    }\n  },\n  async getHotComment(mInfo, page = 1, limit = 20) {\n    // const _requestObj2 = httpFetch('http://c.y.qq.com/base/fcgi-bin/fcg_global_comment_h5.fcg', {\n    //   method: 'POST',\n    //   headers: {\n    //     'User-Agent': 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)',\n    //   },\n    //   form: {","sourceCodeStart":96,"sourceCodeEnd":132,"githubUrl":"https://github.com/lyswhut/lx-music-desktop/blob/9c364b482e5621a1d38b50e8610d2fb974457e6e/src/renderer/utils/musicSdk/tx/comment.js#L96-L132","documentation":"Thrown by QQ Music's getComment when the legacy comment endpoint at http://c.y.qq.com/base/fcgi-bin/fcg_global_comment_h5.fcg returns non-200 or body.code !== 0 (numeric zero). Uses a POST with form-encoded body. The HTTP scheme is plain http (not https). Requires a songId resolved from songmid via getSongId/getMusicInfo. Reads body.comment.commentlist and body.comment.commenttotal.","triggerScenarios":"Calling getComment(mInfo, page, limit) where songId resolution fails or returns an invalid ID. The fcg_global_comment endpoint is rate-limited or deprecated by Tencent. Plain HTTP is intercepted or blocked. body.code is a non-zero error code (e.g., song has no comments or is region-restricted).","commonSituations":"Tencent deprecates the legacy fcg_global_comment_h5.fcg endpoint in favor of the newer musicu.fcg API. ISP or GFW interference with c.y.qq.com over HTTP. Region restrictions on certain songs. songId from getMusicInfo is stale or invalid.","solutions":["Log body.code and statusCode before the throw to identify the failure type.","Verify the resolved songId is valid by checking getSongId's return value.","Consider migrating to the newer https://u.y.qq.com/cgi-bin/musicu.fcg endpoint (as getHotComment already uses).","Retry with backoff for transient rate-limiting.","Switch the URL from http:// to https:// if the environment blocks plain HTTP."],"exampleFix":"// before\nconst { body, statusCode } = await _requestObj.promise\nif (statusCode != 200 || body.code !== 0) throw new Error('获取评论失败')\n\n// after\nconst { body, statusCode } = await _requestObj.promise\nif (statusCode != 200 || !body || body.code !== 0) {\n  console.warn('tx getComment failed', { statusCode, code: body?.code })\n  throw new Error('获取评论失败')\n}","handlingStrategy":"try-catch","validationCode":"function hasTxSongId(mInfo) {\n  return mInfo != null && (!!mInfo.songId || !!mInfo.songmid)\n}","typeGuard":"function isTxCommentResponse(body) {\n  return body != null && typeof body === 'object' && body.code === 0 && body.comment != null\n}","tryCatchPattern":"try {\n  const result = await txComment.getComment(mInfo, page, limit)\n} catch (err) {\n  if (err.message === '获取评论失败') {\n    console.warn('QQ Music comments unavailable for', mInfo.songmid)\n    return { source: 'tx', comments: [], total: 0, page, limit, maxPage: 1 }\n  }\n  throw err\n}","preventionTips":["Verify songId resolution succeeds before calling getComment.","Log body.code to distinguish API errors from transport failures.","Consider migrating from the legacy fcg endpoint to the newer musicu.fcg endpoint.","Be aware the URL uses plain HTTP — test in your network environment.","Retry with backoff for transient rate-limiting."],"tags":["tencent","qq-music","comments","network","api-contract","http","legacy-endpoint"],"backgroundTag":null,"analyzedSha":"9c364b482e5621a1d38b50e8610d2fb974457e6e","analyzedAt":"2026-08-12T15:14:48.244Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}