fix: bgutil-ytdlp-pot-provider ile PO-token duvarını aş
Cookie bot-check'i çözdü ama "The page needs to be reloaded" hatası kalıcıydı — YouTube artık proof-of-origin token da istiyor. Coolify stack'ine brainicism/bgutil-ytdlp-pot-provider sidecar servisi (sc_pot_provider, port 4416) eklendi, api-daemon imajına Python plugin'i kuruldu, her yt-dlp çağrısına --extractor-args youtubepot-bgutilhttp:base_url=... eklendi. ytdlpCookieArgs -> ytdlpAntiBotArgs olarak birleştirildi. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -4,11 +4,13 @@ import { env } from "./env";
|
||||
const COOKIES_PATH = "/tmp/yt-cookies.txt";
|
||||
|
||||
/**
|
||||
* YouTube increasingly bot-checks yt-dlp requests from datacenter IPs
|
||||
* ("Sign in to confirm you're not a bot"), which no --extractor-args
|
||||
* combination reliably bypasses. An authenticated session's cookies avoid
|
||||
* the check. The cookies file is never committed — it's decoded once at
|
||||
* startup from a Coolify-managed env var into a local temp file.
|
||||
* YouTube's anti-bot layer against datacenter IPs has two parts, both
|
||||
* needed together: a "Sign in to confirm you're not a bot" wall (avoided
|
||||
* with an authenticated session's cookies) and a "The page needs to be
|
||||
* reloaded" proof-of-origin token check (avoided by querying the
|
||||
* bgutil-ytdlp-pot-provider sidecar — see docker-compose.yml sc_pot_provider).
|
||||
* The cookies file is never committed — it's decoded once at startup from a
|
||||
* Coolify-managed env var into a local temp file.
|
||||
*/
|
||||
const cookiesFilePath: string | null = env.ytdlpCookiesB64
|
||||
? (() => {
|
||||
@@ -17,6 +19,16 @@ const cookiesFilePath: string | null = env.ytdlpCookiesB64
|
||||
})()
|
||||
: null;
|
||||
|
||||
export function ytdlpCookieArgs(): string[] {
|
||||
return cookiesFilePath ? ["--cookies", cookiesFilePath] : [];
|
||||
export function ytdlpAntiBotArgs(): string[] {
|
||||
const args: string[] = [];
|
||||
|
||||
if (cookiesFilePath) {
|
||||
args.push("--cookies", cookiesFilePath);
|
||||
}
|
||||
|
||||
if (env.ytdlpPotProviderUrl) {
|
||||
args.push("--extractor-args", `youtubepot-bgutilhttp:base_url=${env.ytdlpPotProviderUrl}`);
|
||||
}
|
||||
|
||||
return args;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user