The only downloader you need. 下载器的集大成者。
TypeScript asyncasynciobittorentbtcross-platformdownload-managerdownloaderfluent-designftphttp3magnetpyqtpyside6pythonqtquicreactsoftwarestreaming
fix(yt_dlp): 字幕下载报错 AttributeError 和 429
XiaoYouChRd6a4248d9d4d
diff --git a/features/yt_dlp_pack/config.py b/features/yt_dlp_pack/config.pyindex 969a5e82..77c448b0 100644--- a/features/yt_dlp_pack/config.py+++ b/features/yt_dlp_pack/config.py@@ -50,6 +50,21 @@ def saveCookiesIfBetter(cookieString: str) -> None:saveCookies(cookieString)+def loadCookieHeader() -> str:+ path = cookieFile()+ if not path.is_file():+ return ""+ pairs = []+ for line in path.read_text(encoding="utf-8").splitlines():+ line = line.strip()+ if not line or line.startswith("#"):+ continue+ parts = line.split("\t")+ if len(parts) >= 7:+ pairs.append(f"{parts[5]}={parts[6]}")+ return "; ".join(pairs)++def clearCookies() -> None:path = cookieFile()if path.is_file():diff --git a/features/yt_dlp_pack/task.py b/features/yt_dlp_pack/task.pyindex 2e258875..f5b10e7d 100644--- a/features/yt_dlp_pack/task.py+++ b/features/yt_dlp_pack/task.py@@ -500,6 +500,7 @@ class YouTubeMergeStep(FFmpegStep):from app.client import buildClientfrom app.platform.filesystem import toSafeFilename+ from .config import loadCookieHeaderinfo = await asyncio.to_thread(probeFormats, self.videoUrl or self.task.url)languages = [s.strip() for s in self.task.subtitleLanguages.split(",") if s.strip()]@@ -507,7 +508,8 @@ class YouTubeMergeStep(FFmpegStep):outputFolder = self.task.outputFolderoutputFolder.mkdir(parents=True, exist_ok=True)- client = buildClient()+ cookieHeader = loadCookieHeader()+ client = buildClient(headers={"cookie": cookieHeader} if cookieHeader else None)try:for lang in languages:try:@@ -525,11 +527,14 @@ class YouTubeMergeStep(FFmpegStep):if not subtitle:continueresponse = await client.get(subtitle["url"])- response.raise_for_status()- safeLang = toSafeFilename(lang, fallback="subtitle")- autoSuffix = ".auto" if isAuto else ""- vttFile = outputFolder / f"{stem}.{safeLang}{autoSuffix}.vtt"- vttFile.write_bytes(await response.read())+ try:+ response.raise_for_status()+ safeLang = toSafeFilename(lang, fallback="subtitle")+ autoSuffix = ".auto" if isAuto else ""+ vttFile = outputFolder / f"{stem}.{safeLang}{autoSuffix}.vtt"+ vttFile.write_bytes(await response.bytes())+ finally:+ response.close()except Exception:logger.opt(exception=True).debug("Subtitle download failed: {}", lang)finally: