Skip to content

feat(ytdlp): add proxy failover setting - #259

Merged
krau merged 1 commit into
krau:mainfrom
ilhamsyahids:feat/ytdlp-proxies
Nov 16, 2026
Merged

krau merged 1 commit into
krau:mainfrom
ilhamsyahids:feat/ytdlp-proxies

Conversation

@ilhamsyahids

@ilhamsyahids ilhamsyahids commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Problem

In v1, yt-dlp has no way to use a proxy. --proxy is rejected in custom flags, and the global proxy and the Telegram proxy only affect Go's HTTP client and the MTProto connection, never the yt-dlp process. Deployments where destinations block the server's IP have no way around it.

Change

Adds ytdlp.proxies, an ordered list of proxy URLs for yt-dlp. Supported schemes: http, https, socks4, socks4a, socks5, socks5h.

yt-dlp accepts only one proxy, so the bot rotates for it. Each proxy gets one full yt-dlp run, in the order listed, and the first success is used.

  • Blank and duplicate entries are skipped. With no proxies set, yt-dlp connects directly as before.
  • Cancelling a task stops the rotation immediately.
  • Proxy passwords are redacted in logs and in task errors. yt-dlp sometimes echoes the proxy URL in connection errors, and task errors are stored and sent to webhooks.
  • Partial files (.part, .ytdl, .temp) left by a failed attempt are not uploaded.
  • The same rotation applies to the media metadata API, so a lookup can't call a URL unreachable when a download would succeed.

Settings:

  • Proxy URLs are checked when the yt-dlp settings are saved.
  • A new list field, Settings → yt-dlp → yt-dlp proxies, with en and zh labels.
  • A v0 [ytdlp] proxies entry is imported on first start, as an array or a comma-separated string.

Custom flags are unchanged: --proxy stays forbidden there.

Docs: a new Proxies section in docs/content/{en,zh}/usage/ytdlp.md, and the forbidden-flags list there now names --proxy, --cookies and --netrc.

Notes

  • A URL that fails everywhere, such as a deleted video, costs one run per proxy before the task fails. The docs say to list only proxies you expect to work.
  • Proxy URLs aren't masked in the settings API response, same as the existing parser.proxy. The settings masking only handles single text values, not lists. Only the admin can see this response.

Add ytdlp.proxies, an ordered list of HTTP, HTTPS and SOCKS proxies for
yt-dlp. The global and Telegram proxies do not reach the yt-dlp process,
and --proxy is rejected in custom flags, so yt-dlp had no way to use a
proxy.

yt-dlp accepts one proxy, so downloads and media metadata lookups try
each configured proxy in turn until one succeeds. Blank and duplicate
entries are skipped, cancellation stops the rotation, passwords are
redacted in logs and task errors, and partial files left by a failed
attempt are not uploaded.

Proxy URLs are validated when the yt-dlp settings are saved, and the
list is editable in the web settings and imported from a v0 config.

Signed-off-by: Ilham Syahid S <ilhamsyahids@gmail.com>
@ilhamsyahids
ilhamsyahids marked this pull request as ready for review November 16, 2026 10:17
@krau
krau merged commit a8b1bfe into krau:main Nov 16, 2026
3 checks passed
@ilhamsyahids
ilhamsyahids deleted the feat/ytdlp-proxies branch November 16, 2026 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants