From ea565b8a9f2235ffe08da7c73a442d68c70a9cbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=80=9D=E8=AF=BA=E7=89=B9?= Date: Tue, 15 Apr 2025 10:44:00 +0800 Subject: [PATCH] =?UTF-8?q?fix(bilibili=5Fdownloader):=20=E7=A7=BB?= =?UTF-8?q?=E9=99=A4=E9=9F=B3=E9=A2=91=E8=BD=AC=E7=A0=81=E6=AD=A5=E9=AA=A4?= =?UTF-8?q?=E5=B9=B6=E6=9B=B4=E6=94=B9=E8=BE=93=E5=87=BA=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除了 ydl_opts 中的 postprocessors 设置,取消了将音频转码为 mp3 的步骤 - 将输出音频文件的扩展名从 mp3 改为 m4a --- backend/app/downloaders/bilibili_downloader.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/backend/app/downloaders/bilibili_downloader.py b/backend/app/downloaders/bilibili_downloader.py index f167160..2ab34e2 100644 --- a/backend/app/downloaders/bilibili_downloader.py +++ b/backend/app/downloaders/bilibili_downloader.py @@ -31,13 +31,6 @@ class BilibiliDownloader(Downloader, ABC): ydl_opts = { 'format': 'bestaudio[ext=m4a]/bestaudio/best', 'outtmpl': output_path, - 'postprocessors': [ - { - 'key': 'FFmpegExtractAudio', - 'preferredcodec': 'mp3', - 'preferredquality': '64', - } - ], 'noplaylist': True, 'quiet': False, } @@ -48,7 +41,7 @@ class BilibiliDownloader(Downloader, ABC): title = info.get("title") duration = info.get("duration", 0) cover_url = info.get("thumbnail") - audio_path = os.path.join(output_dir, f"{video_id}.mp3") + audio_path = os.path.join(output_dir, f"{video_id}.m4a") return AudioDownloadResult( file_path=audio_path,