fix: canlı-tespit fetch'ine cookie ekle — AB consent duvarını aş
Coolify sunucusu AB'de; oturumsuz istek YouTube'un interaktif consent sayfasına düşüyor (o sayfada videoDetails yok), bu da gerçekten canlı bir kanalı "değil" gibi gösteriyordu (doğrulandı: @ertemsener canlıydı, sistem "değil" dedi). yt-dlp için zaten sakladığımız oturum açık cookie'leri aynı fetch'e Cookie header'ı olarak eklendi — giriş yapılmış hesaplar consent duvarını hiç görmüyor. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -33,3 +33,25 @@ export async function ytdlpAntiBotArgs(): Promise<string[]> {
|
||||
|
||||
return args;
|
||||
}
|
||||
|
||||
/**
|
||||
* Same cookies, formatted as a `Cookie:` header for plain fetch() calls
|
||||
* (youtubePolling.ts's live-check). Logged-in cookies also skip YouTube's
|
||||
* interactive EU consent wall, which an unauthenticated fetch from an
|
||||
* EU-geolocated server IP otherwise hits — that page has no `videoDetails`,
|
||||
* so the check would misreport a genuinely live channel as offline.
|
||||
*/
|
||||
export async function getCookieHeader(): Promise<string | null> {
|
||||
const setting = await prisma.appSetting.findUnique({ where: { key: COOKIES_SETTING_KEY } });
|
||||
if (!setting?.value) return null;
|
||||
|
||||
const pairs = setting.value
|
||||
.split("\n")
|
||||
.map((line) => line.trim())
|
||||
.filter((line) => line && !line.startsWith("#"))
|
||||
.map((line) => line.split("\t"))
|
||||
.filter((fields) => fields.length >= 7)
|
||||
.map(([, , , , , name, value]) => `${name}=${value}`);
|
||||
|
||||
return pairs.length > 0 ? pairs.join("; ") : null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user