YouTube blocks
The symptom
Section titled “The symptom”Mendil says in chat that YouTube is refusing requests from this server, or the log shows:
Sign in to confirm you're not a botor HTTP Error 429. Playback stops and the queue is kept, so nothing is lost while you fix it.
Why it happens
Section titled “Why it happens”YouTube treats traffic from data-center IP ranges (VPS and cloud providers) with suspicion and often asks those IPs to sign in. Home connections are rarely affected. Whether your server is affected depends on your provider and changes over time. Many servers never see it.
Mendil keeps yt-dlp current in the background, daily and whenever extraction breaks, so an outdated yt-dlp is rarely the cause. An update doesn’t fix this error either.
Fix 1: cookies from a YouTube account
Section titled “Fix 1: cookies from a YouTube account”Mendil passes the cookies of a logged-in browser session to yt-dlp.
⚠️ Use a throwaway Google account, not your main one. Automated use can get the account flagged.
- Sign in to YouTube with the throwaway account in a private (incognito) window.
- In the same window, export the cookies in Netscape format with a cookies.txt browser extension.
- Close the private window right away. YouTube rotates cookies of open sessions, which would invalidate your export. The yt-dlp wiki explains this in detail.
- Put the file next to
docker-compose.ymlascookies/cookies.txt. It must be writable by the container user (uid 1000), because yt-dlp saves refreshed cookies back to it:Terminal window sudo chown -R 1000:1000 cookies - In
docker-compose.yml, uncomment the cookies volume (- ./cookies:/cookies). Don’t mount it read-only, or yt-dlp fails. - In
.env, set:YTDLP_COOKIES_FILE=/cookies/cookies.txt - Run
docker compose up -d, then type!resumein chat.
Cookies expire eventually. If the error comes back after weeks or months, export them again.
Fix 2: a proxy
Section titled “Fix 2: a proxy”Send yt-dlp’s traffic through a connection YouTube trusts more, such as a residential proxy or a home connection:
YTDLP_PROXY=socks5://user:password@proxy.example.com:1080http://, https:// and socks5:// URLs work. Only YouTube traffic (yt-dlp) goes through the proxy. The TeamSpeak connection does not.
Fix 3: PO tokens (advanced, not built in yet)
Section titled “Fix 3: PO tokens (advanced, not built in yet)”YouTube also uses “proof of origin” tokens, which yt-dlp can get from a provider plugin; the yt-dlp PO Token Guide describes how. Mendil doesn’t bundle a provider yet, but it is on the roadmap.
Still stuck?
Section titled “Still stuck?”Open an issue with the yt-dlp error from docker compose logs mendil. Remove cookies, passwords and IPs first.
