fix: capture'da android player_client'ı kapat (videoplayback 403 kaynağı olabilir)
@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 <noreply@anthropic.com>
This commit is contained in:
@@ -108,7 +108,7 @@ async function runCapture(job: Job<StreamIngestJob>): Promise<void> {
|
||||
"yt-dlp",
|
||||
[
|
||||
"--js-runtimes", "node",
|
||||
...(await ytdlpAntiBotArgs(channelDbId)),
|
||||
...(await ytdlpAntiBotArgs(channelDbId, { includeAndroidClient: false })),
|
||||
"-f", "bestvideo+bestaudio/best", "-o", "-", youtubeUrl,
|
||||
],
|
||||
{ stdio: ["ignore", "pipe", "pipe"] },
|
||||
|
||||
@@ -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<string[]> {
|
||||
export async function ytdlpAntiBotArgs(
|
||||
channelKey: string,
|
||||
{ includeAndroidClient = true }: { includeAndroidClient?: boolean } = {},
|
||||
): Promise<string[]> {
|
||||
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<string[]> {
|
||||
// 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));
|
||||
|
||||
Reference in New Issue
Block a user