Submitted by sudo in Privacy

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://127.0.0.1:9150. This tells youtube-dl to route all of its internet traffic through the IP address 127.0.0.1 (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.

Notes:

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.

3

Comments

You must log in or register to comment.

There's nothing here…