Support a proxy for networks where YouTube is unreachable

YTDLP_PROXY routes every yt-dlp call — search, metadata and the audio
stream, for YouTube and SoundCloud alike — through an http(s) or SOCKS
proxy such as a local Psiphon. Startup logs which proxy is in use with
any credentials stripped.

ffmpeg has no SOCKS support, so with a proxy configured playback always
goes through the yt-dlp pipe instead of a resolved CDN URL: nothing
escapes past the proxy, at the cost of slower seeking. Direct links keep
using ffmpeg, which gets the proxy only when it speaks http(s).

Verified against a dead proxy: requests fail through it rather than
quietly going direct.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Leonid Pershin
2026-09-09 00:24:09 +03:00
co-authored by Claude Opus 5
parent 6d65134f8e
commit 71b9b7fe17
7 changed files with 104 additions and 24 deletions
+21 -19
View File
@@ -1,19 +1,21 @@
name: stoat-mbot
services:
mbot:
build: .
restart: always
env_file: .env
ports:
# Наружу не торчит: домен вешается на внешний Caddy хоста.
- "127.0.0.1:3005:3005"
extra_hosts:
# Домен Stoat резолвится в хост, где внешний Caddy держит валидный TLS.
# Так бот ходит в API, gateway и LiveKit ровно как обычный клиент,
# без зависимости от NAT loopback на роутере.
# Замените на свой домен:
- "chat.example.com:host-gateway"
volumes:
# cookies.txt для yt-dlp и/или локальная медиатека
- ./data:/data
name: stoat-mbot
services:
mbot:
build: .
restart: always
env_file: .env
ports:
# Наружу не торчит: домен вешается на внешний Caddy хоста.
- "127.0.0.1:3005:3005"
extra_hosts:
# Домен Stoat резолвится в хост, где внешний Caddy держит валидный TLS.
# Так бот ходит в API, gateway и LiveKit ровно как обычный клиент,
# без зависимости от NAT loopback на роутере.
# Замените на свой домен:
- "chat.example.com:host-gateway"
# Раскомментируйте, если YTDLP_PROXY указывает на прокси, поднятый на хосте:
# - "host.docker.internal:host-gateway"
volumes:
# cookies.txt для yt-dlp и/или локальная медиатека
- ./data:/data