From 63443f3392adca023af852060688e267005ed1ab Mon Sep 17 00:00:00 2001 From: ayrisdev Date: Thu, 3 Sep 2026 00:25:58 +0300 Subject: [PATCH] =?UTF-8?q?fix:=20capture'da=20android=20player=5Fclient'?= =?UTF-8?q?=C4=B1=20kapat=20(videoplayback=20403=20kayna=C4=9F=C4=B1=20ola?= =?UTF-8?q?bilir)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @liberotv'de segment indirirken sürekli "403 Forbidden / Failed to open segment" hatası vardı — kendi ayrılmış proxy IP'sinde bile. yt-dlp'nin GitHub issue'larında android client'ının videoplayback isteklerinde 403'e sebep olduğu birden fazla kez raporlanmış. Tespit adımı (--simulate, format çözümlemesi yok) risksiz olduğu için web,mweb,android'i koruyor; asıl capture artık sadece web,mweb kullanıyor. Co-Authored-By: Claude Sonnet 5 --- apps/api-daemon/src/capture/streamIngest.ts | 2 +- apps/api-daemon/src/ytdlpCookies.ts | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/apps/api-daemon/src/capture/streamIngest.ts b/apps/api-daemon/src/capture/streamIngest.ts index b83897a..80a9dd1 100644 --- a/apps/api-daemon/src/capture/streamIngest.ts +++ b/apps/api-daemon/src/capture/streamIngest.ts @@ -108,7 +108,7 @@ async function runCapture(job: Job): Promise { "yt-dlp", [ "--js-runtimes", "node", - ...(await ytdlpAntiBotArgs(channelDbId)), + ...(await ytdlpAntiBotArgs(channelDbId, { includeAndroidClient: false })), "-f", "bestvideo+bestaudio/best", "-o", "-", youtubeUrl, ], { stdio: ["ignore", "pipe", "pipe"] }, diff --git a/apps/api-daemon/src/ytdlpCookies.ts b/apps/api-daemon/src/ytdlpCookies.ts index 0eb3380..3ab48a3 100644 --- a/apps/api-daemon/src/ytdlpCookies.ts +++ b/apps/api-daemon/src/ytdlpCookies.ts @@ -46,7 +46,10 @@ function proxyUrlForChannel(baseProxyUrl: string, channelKey: string): string { * current value and rewrites the temp file, so a panel update takes effect * on the very next yt-dlp invocation without a redeploy. */ -export async function ytdlpAntiBotArgs(channelKey: string): Promise { +export async function ytdlpAntiBotArgs( + channelKey: string, + { includeAndroidClient = true }: { includeAndroidClient?: boolean } = {}, +): Promise { const args: string[] = []; const setting = await prisma.appSetting.findUnique({ where: { key: COOKIES_SETTING_KEY } }); @@ -64,7 +67,15 @@ export async function ytdlpAntiBotArgs(channelKey: string): Promise { // you're not a bot" ile tıkanabiliyor — küçük kanallarda aynı kombinasyon // sorunsuz çalışıyor. mweb/android'i cookie-uyumlu fallback olarak // ekleyip yt-dlp'nin ilk başarılı client'ı kullanmasını sağlıyoruz. - args.push("--extractor-args", "youtube:player_client=web,mweb,android"); + // + // Ama "android" client'ı yt-dlp'nin kendi GitHub issue'larında birden + // fazla kez videoplayback/segment isteklerinde 403 Forbidden'a sebep + // olarak raporlanmış — sade metadata/tespit isteğinde (--simulate, format + // çözümlemesi yok) risk taşımıyor ama gerçek segment indirimi sırasında + // (asıl capture) bu 403'lerin kaynağı olabilir. O yüzden capture çağrısı + // android'i devre dışı bırakıyor, sadece tespit çağrısı kullanıyor. + const clients = includeAndroidClient ? "web,mweb,android" : "web,mweb"; + args.push("--extractor-args", `youtube:player_client=${clients}`); if (env.proxyUrl) { args.push("--proxy", proxyUrlForChannel(env.proxyUrl, channelKey));