PiratProxies

Automation and testing

Sending yt-dlp traffic through a proxy

yt-dlp downloads video and audio from the command line. One option sends it through a proxy.

The right proxy type for yt-dlp

Unlimited Datacenter is billed for time, not for gigabytes, which suits large downloads. Its IP addresses are in the United States.

The values to enter in yt-dlp

Every PiratProxies plan comes down to four values: host, port, username and password. Here they are for Unlimited Datacenter; your own username and password are on your plan page.

HostIP_ADDRESS
HTTP port777
SOCKS5 port666
UsernameUSERNAME
Passwordshown on your plan page

Written as a single address:

http://USERNAME:PASSWORD@IP_ADDRESS:777

There is no separate country or session field: both are part of the username. Your plan page has a generator that writes it, and Targeting and sessions describes each piece.

Setting it up in yt-dlp

  1. Add --proxy with the proxy address.
  2. Use --geo-verification-proxy instead if you only want the proxy for the location check and the download itself to go direct.

Code: yt-dlp through a proxy

HTTP

yt-dlp --proxy "http://USERNAME:PASSWORD@IP_ADDRESS:777" "VIDEO_URL"

SOCKS5

yt-dlp --proxy "socks5://USERNAME:PASSWORD@IP_ADDRESS:666" "VIDEO_URL"

Put your own login from the plan page in place of USERNAME and PASSWORD. The example calls an IP-check service, so what it prints is the address your request came from.

Should yt-dlp rotate IPs or keep one?

When yt-dlp plays one visitor across several steps, a sticky session keeps the IP address unchanged from start to finish. When every run stands alone, drop the session and each run begins from a new address.

Here is what a sticky username looks like:

USERNAME

When yt-dlp will not connect

  • Video is heavy. One hour of high-definition video can be several gigabytes, so a time-based Unlimited Datacenter plan is usually the sensible choice.
  • Keep the address in quotes, so the shell does not trip over characters in it.
  • Error 407 means the login was refused. Copy the username and password from your plan page once more, and make sure no space crept in and the username was not cut short.
  • An IP in the wrong country nearly always comes from the username, since the country code lives there. Other fixes.

yt-dlp and proxies: questions

Can yt-dlp use a SOCKS5 proxy?

Yes. Point it at port 666 with the same username and password.

Which PiratProxies plan suits yt-dlp best?

Unlimited Datacenter is billed for time, not for gigabytes, which suits large downloads. Its IP addresses are in the United States.

Words used in this guide: headless browser, rotating proxy, sticky session, proxy authentication.

yt-dlp belongs to its own developers, and PiratProxies has no connection with them; we name it only to say what this guide covers. Follow the rules of the sites you visit and our acceptable use policy.