browser-based client for watching Youtube anonymously and with greater page performance
browser-based client for watching Youtube anonymously and with greater page performance
youtube-local is a browser-based client written in Python for watching Youtube anonymously and without the lag of the slow page used by Youtube. One of the primary features is that all requests are routed through Tor, except for the video file at googlevideo.com. This is analogous to what HookTube (defunct) and Invidious do, except that you do not have to trust a third-party to respect your privacy. The assumption here is that Google won't put the effort in to incorporate the video file requests into their tracking, as it's not worth pursuing the incredibly small number of users who care about privacy (Tor video routing is also provided as an option). Tor has high latency, so this will not be as fast network-wise as regular Youtube. However, using Tor is optional; when not routing through Tor, video pages may load faster than they do with Youtube's page depending on your browser.
The Youtube API is not used, so no keys or anything are needed. It uses the same requests as the Youtube webpage.
Download the zip file under the Releases page. Unzip it anywhere you choose.
Download the tarball under the Releases page and extract it. cd into the directory and run
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
python server.pyDepending on your distribution, you may need to use python3 and pip3 instead.
Note: If pip isn't installed, first try installing it from your package manager. Make sure you install pip for python 3. For example, the package you need on debian is python3-pip rather than python-pip. If your package manager doesn't provide it, try to install it according to this answer, but make sure you run python3 get-pip.py instead of python get-pip.py
To run the program on windows, open run.bat. On Linux/MacOS, first activate the virtual environment with source venv/bin/activate then run python server.py.
Note for Mac users: If you installed Python from the installer on python.org, you will need to have run the file Install Certificates.command in the directory Applications/Python 3.x where x is the minor version of python. Otherwise, you will get the error certificate verify failed: unable to get local issuer certificate. There is a similar file in that directory you can run to get the python3 command installed for the terminal.
To run it at startup on Windows, right click run.bat and click "Create Shortcut." Then, move the shortcut to the Startup folder. You can access the Startup folder by pressing Windows Key + R and typing shell:startup.
Access youtube URLs by prefixing them with http://localhost:8080/, For instance, http://localhost:8080/https://www.youtube.com/watch?v=vBgulDeV2RU
You can use an addon such as Redirector (Firefox|Chrome) to automatically redirect Youtube URLs to youtube-local. I use the include pattern ^(https?://(?:[a-zA-Z0-9_-]*\.)?(?:youtube\.com|youtu\.be|youtube-nocookie\.com)/.*) and the redirect pattern http://localhost:8080/$1 (Make sure you're using regular expression mode).
If you want embeds on the web to also redirect to youtube-local, make sure "Iframes" is checked under advanced options in your redirector rule.
youtube-local can be added as a search engine in firefox to make searching more convenient. See here for information on firefox search plugins.
If you wish to run this in portable mode, create the empty file "settings.txt" in the program's main directory. If the file is there, settings and data will be stored in the same directory as the program. Otherwise, settings and data will be stored in C:\Users\[your username]\.youtube-local on Windows and ~/.youtube-local on Linux/MacOS.
In the settings page, set "Route Tor" to "On, except video" (the second option). Be sure to save the settings.
Ensure Tor is listening for Socks5 connections on port 9150. A simple way to accomplish this is by opening the Tor Browser Bundle and leaving it open. However, you will not be accessing the program (at https://localhost:8080) through the Tor Browser. You will use your regular browser for that. Rather, this is just a quick way to give the program access to Tor routing.
If you don't want to waste system resources leaving the Tor Browser open in addition to your regular browser, you can configure standalone Tor to run instead using the following instructions.
For Windows, to make standalone Tor run at startup, press Windows Key + R and type shell:startup to open the Startup folder. Create a new shortcut there. For the command of the shortcut, enter "C:\[path-to-Tor-Browser-directory]\Tor\tor.exe" SOCKSPort 9150 ControlPort 9151. You can then launch this shortcut to start it. Alternatively, if something isn't working, to see what's wrong, open cmd.exe and go to the directory C:\[path-to-Tor-Browser-directory]\Tor. Then run tor SOCKSPort 9150 ControlPort 9151 | more. The more part at the end is just to make sure any errors are displayed, to fix a bug in Windows cmd where tor doesn't display any output. You can stop tor in the task manager.
For Debian/Ubuntu, you can sudo apt install tor to install the command line version of Tor, and then run sudo systemctl start tor to run it as a background service that will get started during boot as well. However, Tor on the command line uses the port 9050 by default (rather than the 9150 used by the Tor Browser). So you will need to change Tor port to 9050 and Tor control port to 9051 in the youtube-local settings page. Additionally, you will need to enable the Tor control port by uncommenting the line ControlPort 9051, and setting CookieAuthentication to 0 in /etc/tor/torrc. If no Tor package is available for your distro, you can configure the tor binary located at ./Browser/TorBrowser/Tor/tor inside the Tor Browser installation location to run at start time, or create a service to do it.
If you wish to route the video through Tor, set "Route Tor" to "On, including video". Because this is bandwidth-intensive, you are strongly encouraged to donate to the consortium of Tor node operators. For instance, donations to NoiseTor go straight towards funding nodes. Using their numbers for bandwidth costs, together with an average of 485 kbit/sec for a diverse sample of videos, and assuming n hours of video watched per day, gives $0.03n/month. A $1/month donation will be a very generous amount to not only offset losses, but help keep the network healthy.
In general, Tor video routing will be slower (for instance, moving around in the video is quite slow). I've never seen any signs that watch history in youtube-local affects on-site Youtube recommendations. It's likely that requests to googlevideo are logged for some period of time, but are not integrated into Youtube's larger advertisement/recommendation systems, since those presumably depend more heavily on in-page tracking through Javascript rather than CDN requests to googlevideo.
YouTube and YouTube Music/subscriptions/subscriptions.csvSupported subscriptions import formats:
Pull requests and issues are welcome. Please do not submit AI generated pull requests or issues.
For coding guidelines and an overview of the software architecture, see the HACKING.md file.
This project is licensed under the GNU Affero General Publi
No open issues yet, or sync has not completed.