Submitted by sudo in Tech

Step 1. Install tor and tor browser (if you haven't already).

Step 2. Install the fabulous youtube-dl. This utility lets you download youtube videos. Debian users can install it via sudo apt install youtube-dl. Get it from the backports repository if you know how to do that.

Step 3. Create a config file for youtube-dl, telling it to route all traffic through tor browser. If you're on Linux or OSX, create this file: /etc/youtube-dl.conf if it doesn't exist already. If you're on Windows, install Linux, because it's far better for privacy. But if you must remain on Windows, create a file at %APPDATA%\youtube-dl\config.txt, if it doesn't exist already.

Step 4. Open up the config file in a text editor. Add this line: --proxy socks5:// This tells youtube-dl to route all of its internet traffic through the IP address (which is always your own computer), and to use port 9150 (which is the port tor browser listens on). Note that this means tor browser must be running in order for this to work. If it's not running, youtube-dl won't be able to reach anything. You can also try using port 9050 instead of 9150, which will make it go through tor directly instead of using the browser, but I haven't been able to make this work. If it does work for you, remember that you will have to manually restart the tor service whenever you want to create a new circuit. Because of this, I find it much easier to stick with the tor browser.

Step 5. Save and close the config file. You are now ready to download the video. Open up tor browser, and copy the URL for the youtube video you want to download. Open a terminal, then type youtube-dl <URL>, where URL is the URL you just copied. This will download the video into whatever directory you're currently in. It may take a little while, since all of the traffic is going through tor.

Step 6. Watch the video.

Ta-da! You can now watch youtube videos without running any privacy-destroying javascript code.


If the download is taking way too long, it might be because the resolution of the video you're trying to download is too large. Youtube-dl will always try to download the highest resolution available, which may take hours to do over tor. Run youtube-dl -F <URL> to see what resolutions are available. Once you find one you want, run youtube-dl -f <format> <URL>. I generally go with -f 43, which gives you 640x360 webm videos.

If you only want to download the audio, run youtube-dl -x <URL> (just remember X for eXtract the audio). This is useful for when you want to download music from youtube.

Youtube-dl can download from more than just youtube. Some other popular sites it can download from include Vimeo, Twitter, Soundcloud, and Bandcamp, to name just a few (but there are actually hundreds of websites it can download from). Run youtube-dl --list-extractors to see if it can download from the website you want.



You must log in or register to comment.

autonomous_hippopotamus wrote

wow thanks! this is great!

I used to be able to just watch it on youtube, but i think they have been messinging with the javascript to where you have to allow all these trackers to get the video to play, i've gotten around it by watching youtube videos through


sudo OP wrote

Neat, I didn't know DuckDuckGo let you watch youtube videos.


autonomous_hippopotamus wrote

yeah, you gotta have java script enabled, mess with no-script for a minute.. .but yeah you can watch videos from youtube, vimeo etc. under the 'videos tab' without going to the site.


LostWithPurpose wrote

Startpage does too, but it has this warning:

When you play a YouTube video here, your privacy protection will be the same as if you played it directly on YouTube will be aware that you are watching the video, and you may receive a YouTube cookie on your browser.


ziq wrote

So useful. Someone should add this to the wiki.


sudo OP wrote

Thanks! I'll share a few more of my privacy tips here.


Froid wrote

Is the point of this to avoid watching ads?


sudo OP wrote

I suppose it also has the effect that you won't see any ads, but the main reason for doing this is so that you won't be fingerprinted by running any of youtube's javascript code. The only effective way to thwart browser fingerprinting is by using tor browser with the security settings on high, and this means youtube won't work normally. But this method gets around that, while preserving your anonymity.