fix: QQ 音乐未登录时搜索给出明确提示(接口对匿名请求返回空结果)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Jocay
2026-10-10 22:55:13 +08:00
parent 85b2d36b3d
commit 7a3de9afba
2 changed files with 5 additions and 1 deletions
+4
View File
@@ -101,6 +101,10 @@ export class QQProvider implements MusicProvider {
param: { query: keyword, num_per_page: limit, page_num: page, search_type: 0 },
});
const list: any[] = data?.body?.song?.list || [];
// QQ 音乐搜索接口对未登录请求一律返回空结果
if (!list.length && !this.client.auth) {
throw Object.assign(new Error('QQ 音乐搜索需要先登录(设置 → 扫码登录)'), { status: 400 });
}
return { items: list.map((t) => this.toSummary(t)), total: data?.meta?.sum ?? list.length, page, limit };
}