About

Invidious is a self-hosted YouTube proxy server, self-described meagerly as a front-end to YouTube, that can be used to bypass any Google data collection. As part of the same project, there exists a switchboard service at https://invidio.us to which requests to YouTube can be redirected such that the YouTube link is intercepted by Invidious and then proxied back to the client.

This page documents some of the mechanisms, extra software, client and server setup involved with Invidious.

Using Invidious

Using a browser addon such as redirector for FireFox, the browser can be made to redirect requests to https://youtube.com to https://invidio.us while passing any optional parameters for the link.

The template to replace is:

  • https://*youtube.com/watch?*v=*

by:

  • https://invidio.us/watch?$2v=$3

which accomplishes the following:

  • drops any sub domain of youtube.com such as www.youtube.com,
  • passes any extra parameters sent to the YouTube video (ie: time frame) along to the Invidious switchboard (variable 2),
  • passes the actual YouTube video hash to the Invidious switchboard (variable 3)

There are many similar browser addons and extensions that perform the same function so it is not necessary to insist further. Similarly, there are many addons out there that perform the redirect automatically such that there will be no setting up needed.

Hosting Invidious Locally over Tor as a Public Service

To better visualize what will be accomplished, here is a block diagram of the various components involved in hosting Invidious over Tor.

Here are some comments to the architecture:

  • the Tor setup uses ports but it could use sockets in order to not expose ports, even though, the connection takes place over loopback,
  • interpolating caddy makes the setup more flexible by allowing multiple services to coexist on the server tidily,
  • caddy does not match on the generated Tor onion URL as a HTTP Host match ala virtual hosts and the reason therefore is that if caddy were to act as a virtual host, then the default port 80 rule would have to be changed,
  • a user wishing to access YouTube, will connect to the Tor onion address and all the data will flow back and forth through the above pipeline.

One way to setup Invidious such that no domain name is to be required, is to run Invidious over tor using an onion address to access the Invidious instance. The official install instructions should be sufficient to get Invidious up and running and to configure for running a public instance over Tor, the following changes would be recommended:

--- config/config.example.yml   2023-12-07 03:44:20.810315152 +0000
+++ config/config.yml   2023-12-07 07:12:26.838745217 +0000
@@ -38,7 +38,7 @@
 ## Accepted values: true, false
 ## Default: false
 ##
-#check_tables: false
+check_tables: true
 
 
 
@@ -62,7 +62,7 @@
 ## Accepted values: 1-65535
 ## Default: 3000
 ##
-#port: 3000
+port: 1501
 
 ##
 ## When the invidious instance is behind a proxy, and the proxy
@@ -76,7 +76,7 @@
 ## Accepted values: 1-65535
 ## Default: <none>
 ##
-#external_port:
+external_port: 80
 
 ##
 ## Interface address to listen on for incoming connections.
@@ -84,7 +84,7 @@
 ## Accepted values: a valid IPv4 or IPv6 address.
 ## default: 0.0.0.0  (listen on all interfaces)
 ##
-#host_binding: 0.0.0.0
+host_binding: 0.0.0.0
 
 ##
 ## Domain name under which this instance is hosted. This is
@@ -95,7 +95,7 @@
 ## Accepted values: a fully qualified domain name (FQDN)
 ## Default: <none>
 ##
-domain:
+domain: CHANGE ME
 
 ##
 ## Tell Invidious that it is behind a proxy that provides only
@@ -115,7 +115,7 @@
 ## Accepted values: true, false
 ## Default: true
 ##
-#hsts: true
+hsts: false
 
 
 # -----------------------------
@@ -171,7 +171,7 @@
 ## Accepted values: true, false
 ## Default: false
 ##
-# use_innertube_for_captions: false
+use_innertube_for_captions: true
 
 
 # -----------------------------
@@ -229,7 +229,7 @@
 ## Accepted values: true, false
 ## Default: false
 ##
-#statistics_enabled: false
+statistics_enabled: true
 
 
 # -----------------------------
@@ -423,7 +423,7 @@
 ## Accepted values: true, false, a positive integer
 ## Default: false
 ##
-#use_pubsub_feeds: false
+use_pubsub_feeds: true
 
 ##
 ## HMAC signing key used for CSRF tokens, cookies and pubsub
@@ -436,7 +436,7 @@
 ## Accepted values: a string
 ## Default: <none>
 ##
-hmac_key: "CHANGE_ME!!"
+hmac_key: "CHANGE ME"
 
 ##
 ## List of video IDs where the "download" widget must be

All the mentioned keys should contain valid values.

Tor can then be altered to create a separate service to run Invidious:

HiddenServiceDir /opt/invidious-tor/
HiddenServicePort 80 127.0.0.1:1500

where:

  • /opt/invidious-tor/ is the place where the Tor keys will be placed for Invidious,
  • 80 means that Tor will expose the service over port 80,
  • 127.0.0.1:1500 means that Tor will forward all traffic from its external 80 port to 127.0.0.1:1500.

After Tor is restarted, the hostname will be found within the file at /opt/invidious/tor/hostname and it can be added to Invidious as the value of the domain configuration key.

The final step is to configure caddy, and that involves adding just a few lines to the caddy file, typically placed at /etc/caddy/CaddyFile, namely the following lines that pass connections from Tor to Invidious:

:1500 {
        reverse_proxy 127.0.0.1:1501
}

The whole setup can be now restarted and the Tor onion address can be accessed to hopefully bring up the hidden Invidious instance.

Patch for Listing Tor and I2P Instances on the Invidious Switchboard

With some small adjustments to the switchboard, the redirect service can be made to list Tor/onion and I2P addresses as part of the offer on https://invidio.us

diff --git a/src/index.pug b/src/index.pug
index c36c3f1..76aeef5 100644
--- a/src/index.pug
+++ b/src/index.pug
@@ -37,6 +37,7 @@ html(lang="en")
                        table
                                thead
                                        tr
+                                               th(scope="col") Type
                                                th(scope="col") Region
                                                th(scope="col") Domain
                                                th(scope="col") Health
diff --git a/src/main.js b/src/main.js
index 8860c25..2c63302 100644
--- a/src/main.js
+++ b/src/main.js
@@ -56,15 +56,27 @@
                                healthKnown
                        }
                }).filter(entry => {
-                       return entry.details.type === "https" && entry.health > 0
+                       return entry.health > 0
                }).sort((a, b) => {
                        return b.health - a.health
                }).forEach(entry => {
-                       let target = entry.details.uri.replace(/\/*$/, "") + destinationPath
+                       let address = entry.details.uri.replace(/\/*$/, "")
+                       let target = address + destinationPath
                        const healthUnknown = entry.healthKnown ? "" : "health-unknown "
+                       let type = "default"
+                       switch(address.substr(address.lastIndexOf('.')+1))
+                       {
+                               case "onion":
+                                       type = "onion"
+                                       break
+                               case "i2p":
+                                       type = "i2p"
+                                       break
+                       }
                        const health = entry.healthKnown ? entry.health.toFixed(0) : "(unknown)"
                        q("#instances-tbody").appendChild(
                                createElement("tr", {}, [
+                                       createElement("td", {className: "column-center", textContent: type}),
                                        createElement("td", {textContent: `${entry.details.flag} ${entry.details.region}`}),
                                        createElement("td", {textContent: entry.name}),
                                        createElement("td", {className: "column-center "+healthUnknown, textContent: health}),

The patch has been submitted to the official invidious-redirect repository.


youtube/using_invidious_to_bypass_data_collection.txt ยท Last modified: 2023/12/08 18:10 by office

Wizardry and Steamworks

© 2025 Wizardry and Steamworks

Access website using Tor Access website using i2p Wizardry and Steamworks PGP Key


For the contact, copyright, license, warranty and privacy terms for the usage of this website please see the contact, license, privacy, copyright.