Skip to content

Instantly share code, notes, and snippets.

@Albirew
Forked from Tazeki/Reghook.js
Last active August 20, 2020 22:38
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save Albirew/4bb3bee6a8037b44cf67521284e94b93 to your computer and use it in GitHub Desktop.
YouTube / Invidious RegEx based URL conversion.
// ==UserScript==
// @name InviReg - YouTube->Invidious
// @author Albirew, heavily based on script by Tazeki
// @namespace https://gist.github.com/Albirew/
// @description The smallest, possibly most useful YouTube-Invidious conversion script. RegEx based. Sends any /www.youtube.com/ sites to Invidious before page load. Does not affect /other.youtube.com/, (gaming.youtube.com, creatoracademy.youtube.com, etc.).
// @include *youtube*
// @version 1.1c
// @icon https://invidious.fdn.fr/favicon.ico
// @grant none
// @run-at document-start
// @downloadURL https://gist.githubusercontent.com/Albirew/4bb3bee6a8037b44cf67521284e94b93/raw/InviReg.user.js
// @updateURL https://gist.githubusercontent.com/Albirew/4bb3bee6a8037b44cf67521284e94b93/raw/InviReg.user.js
// ==/UserScript==
var url = window.location.toString();
if (url.indexOf('www.youtube.com') !== - 1) {
window.location = url.replace(/www.youtube.com/, 'invidious.fdn.fr');
} else if (url.indexOf('www.youtu.be') !== - 1) {
window.location = url.replace(/www.youtu.be/, 'invidious.fdn.fr');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment