Greasy Fork is available in English.

Redirect YouTube to Invidious (Youtube Anti-Adblock Bypass)

Redirects YouTube video links to an Invidious instance

// ==UserScript==
// @name         Redirect YouTube to Invidious (Youtube Anti-Adblock Bypass)
// @namespace    http://tampermonkey.net/
// @version      1.5
// @description  Redirects YouTube video links to an Invidious instance
// @author       Vila
// @license      GNU GPLv3
// @match        http*://*.youtube.com/watch*
// @match           https://www.youtube.com/*
// @match           https://www.youtube-nocookie.com/*
// @match           https://m.youtube.com/*
// @match           https://music.youtube.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=youtube.com
// @grant        none
// ==/UserScript==

(function() {
  'use strict';

  let url = window.location.href;

  // Only redirect video pages
  if (url.includes('/watch')) {
    let videoId = url.split('v=')[1];
    let ampersandPosition = videoId.indexOf('&');
    if(ampersandPosition != -1) {
      videoId = videoId.substring(0, ampersandPosition);
    }

      //Change invidious instance here
    let newUrl = 'https://iv.datura.network/watch?v=' + videoId;
    window.location.href = newUrl;
  }

})();