🔧 chore: 更新音乐源设置,移除 YouTube,添加 Kuwo,确保平台一致性

This commit is contained in:
alger
2025-05-09 19:43:01 +08:00
parent 44f9709bb3
commit 618c345a78
5 changed files with 14 additions and 11 deletions
+1 -1
View File
@@ -23,5 +23,5 @@
"alwaysShowDownloadButton": false,
"unlimitedDownload": false,
"enableMusicUnblock": true,
"enabledMusicSources": ["migu", "kugou", "pyncmd", "bilibili", "youtube"]
"enabledMusicSources": ["migu", "kugou", "pyncmd", "bilibili", "kuwo"]
}
+8 -4
View File
@@ -1,6 +1,6 @@
import match from '@unblockneteasemusic/server';
type Platform = 'qq' | 'migu' | 'kugou' | 'pyncmd' | 'joox' | 'kuwo' | 'bilibili' | 'youtube';
type Platform = 'qq' | 'migu' | 'kugou' | 'pyncmd' | 'joox' | 'kuwo' | 'bilibili';
interface SongData {
name: string;
@@ -30,7 +30,7 @@ interface UnblockResult {
}
// 所有可用平台
export const ALL_PLATFORMS: Platform[] = ['migu', 'kugou', 'pyncmd', 'kuwo', 'bilibili', 'youtube'];
export const ALL_PLATFORMS: Platform[] = ['migu', 'kugou', 'pyncmd', 'kuwo', 'bilibili'];
/**
* 音乐解析函数
@@ -46,12 +46,16 @@ const unblockMusic = async (
retryCount = 1,
enabledPlatforms?: Platform[]
): Promise<UnblockResult> => {
const platforms = enabledPlatforms || ALL_PLATFORMS;
// 过滤 enabledPlatforms,确保只包含 ALL_PLATFORMS 中存在的平台
const filteredPlatforms = enabledPlatforms
? enabledPlatforms.filter(platform => ALL_PLATFORMS.includes(platform))
: ALL_PLATFORMS;
songData.album = songData.album || songData.al;
songData.artists = songData.artists || songData.ar;
const retry = async (attempt: number): Promise<UnblockResult> => {
try {
const data = await match(parseInt(String(id), 10), platforms,songData);
const data = await match(parseInt(String(id), 10), filteredPlatforms, songData);
const result: UnblockResult = {
data: {
data,