feat: expose vip flag on Song for trial-only detection

Add optional vip?: boolean to the Song interface so downstream clients
(e.g. PowerfulTS) can mark copyright-restricted songs that non-VIP users
can only play as a trial fragment, before playback starts.

- provider.ts: add optional vip?: boolean (backward compatible)
- netease.ts: extract mapNeteaseSongs() pure fn; map fee to vip
  (1=VIP, 4=album-only). fee=8 (free low-quality) is excluded because
  it plays in full, just at lower quality.
- qq.ts: mapQqSongs() maps pay.payplay/paytrackprice to vip (one fix
  covers all callers); getDailyRecommendSongs inline mapping too.
- tests: vip mapping assertions for netease fee (1/4=vip, 0/8=free) and
  qq pay fields.
This commit is contained in:
Slldyd2077 committed 2026-06-28 17:12:57 +08:00
1 parent 06aaec4ba5
commit 7b2bd0ea6a
5 files changed
+62 -59

No files matched your search

+3
View File
@@ -6,6 +6,9 @@ export interface Song {
duration: number; // seconds
coverUrl: string;
platform: "netease" | "qq" | "bilibili" | "youtube";
/** VIP / copyright-restricted: non-VIP users can only play a trial fragment
* (NetEase fee=1 VIP / fee=4 album-only, or QQ pay.payplay/paytrackprice=1). */
vip?: boolean;
}
export interface SongWithUrl extends Song {