Skip to content

Commit 179cfbb

Browse files
🐞 fix: 修复网易云在歌词里拉屎
1 parent 5c9b6d7 commit 179cfbb

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

src/utils/downloadManager.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class DownloadManager {
1717
private queue: DownloadTask[] = [];
1818
private isProcessing: boolean = false;
1919

20-
private constructor() {}
20+
private constructor() { }
2121

2222
public static getInstance(): DownloadManager {
2323
if (!DownloadManager.instance) {
@@ -256,7 +256,14 @@ class DownloadManager {
256256
let lyric = "";
257257
if (downloadLyric) {
258258
const lyricResult = await songLyric(song.id);
259-
lyric = lyricResult?.lrc?.lyric || "";
259+
const rawLyric = lyricResult?.lrc?.lyric || "";
260+
// 排除特定格式的脏数据
261+
const excludeRegex =
262+
/^\{"t":\d+,"c":\[\{"[^"]+":\"[^"]*\"}(?:,\{"[^"]+":\"[^"]*\"})*]}$/;
263+
lyric = rawLyric
264+
.split("\n")
265+
.filter((line) => !excludeRegex.test(line.trim()))
266+
.join("\n");
260267
}
261268

262269
const config = {

0 commit comments

Comments
 (0)