How to use socks proxy for commands in Terminal such as youtube-dl?

ssh -D 8080 [email protected]
export http_proxy=socks5://127.0.0.1:8080 https_proxy=socks5://127.0.0.1:8080
youtube-dl "youtube.com/watch?V=3XjwiV-6_CA"

Youtube-dl doesn't support a SOCKS proxy. There's a feature request for it, with links to a couple of working proposals.

Youtube-dl supports HTTP proxies out of the box. To benefit from this support, you'll need to run a proxy on myserver.com. Pretty much any lightweight proxy will do, for example tinyproxy. The proxy only needs to listen to local connections (Listen 127.0.0.1 in tinyproxy.conf). If the HTTP proxy is listening on port 8035 (Port 8035), run the following ssh command:

ssh -L 8035:localhost:8035 [email protected]

and set the environment variables http_proxy and https_proxy:

export http_proxy=http://localhost:8035/ https_proxy=http://localhost:8035/
youtube-dl youtube.com/watch?V=3XjwiV-6_CA

youtube-dl works well with proxychains on ubuntu. Make sure ur tunneling via command line.

ssh -D 8081 ubuntu@yourSSHserver

next install proxychains on your localhost not the ssh server ur conncted to.

sudo apt-get install proxychains

edit your proxychains config file

sudo nano /etc/proxychains.conf

edit the port number on the last line

socks4  127.0.0.1 8081

Note:I'm using proxychains on port 8081

then just add proxychains to the begining of the command when using youtube-dl

proxychains ./youtube-dl http://thesite.com/yourvideo.hmtl