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));