Guide: Automatically turn Youtube to Invidious, and Twitter to Nitter in Firefox and Chrome
June 17, 2020•326 words
To /r/privacy:
By now I assume most use the HTTPS Everywhere browser extension by the EFF, which directs you to https://site
when typing site
or http://site
. This works by rewriting URLs before your browser attempts to fetch them; HTTPS Everywhere changes the protocol (http --> https) portion of the URL.
However, we can (ab)use this extension to change protocol, domain, path, and query of a URL. We can create rules to transform Twitter to Nitter, and Youtube to Invidious. This means if you click or type a Youtube link, it will automatically be directed to Invidious. Or if you click or type a Twitter page, it will automatically be directed to Nitter.
On Chrome:
- about:extensions
- Click on Details of HTTPS Everywhere
- Click on Extension Options
- Click Advanced Settings
On Firefox:
- about:addons
- Click the ellipsis -> Preferences for HTTPS Everywhere
On both:
- Type ctrl+z, a link should magically appear called "Debugging Rulesets (advanced)"
- Click that link
(If you dare to type all this in on Firefox for Android, go to about:addons, HTTPS Everywhere, Settings, go to the URL bar and change /pages/options/index.html
to /pages/debugging-rulesets/index.html
.
Type these rules in:
<ruleset name="yt2in_nojs">
<target host="youtube.com" />
<target host="www.youtube.com" />
<rule from="^https?://(www\.)?youtube.com/watch\?"
to="https://invidio.us/watch?nojs=1&" />
</ruleset>
<ruleset name="twit2nit">
<target host="twitter.com" />
<target host="www.twitter.com" />
<rule from="^https?://(www\.)?twitter.com/"
to="https://nitter.net/" />
</ruleset>
Hit Save, and now these will automatically transform:
- https://www.youtube.com/watch?v=Oc_ux91TPxM to https://invidio.us/watch?nojs=1&v=Oc_ux91TPxM
- https://twitter.com/EFF to https://nitter.net/EFF
Transforming youtu.be/video
to invidio.us/watch?v=video
is left as an exercise for the reader!
I will point out the disclaimer from HTTPS Everywhere regarding usage of the debugging rulesets:
Warning: This should only be used for debugging rulesets. This feature is not guaranteed to work reliably for regular usage.
This is a (silent) hack and not how HTTPS Everywhere is intended to be used; you will ultimately forget that you did this and scratch your head why web sites are going to other sites. You have been warned.