Invidious Redirect

Redirect YouTube video link to Invidious instances

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

You will need to install an extension such as Tampermonkey to install this script.

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name        Invidious Redirect
// @description Redirect YouTube video link to Invidious instances
// @namespace   io.github.zeinok.invidiousRedirect
// @match       *://youtube.com/watch
// @match       *://*.youtube.com/watch
// @match       *://youtu.be/
// @run-at      document-start
// @grant       none
// @version     1.01
// @author      Zeinok
// ==/UserScript==

/* CONFIG */
// List of invidious instances, will be randomly chosen upon redirection.
// URI schema (https://) is required.
// View list of instances here: https://instances.invidio.us
const instances = ["https://invidious.snopyta.org", "https://yewtu.be", "https://invidious.xyz", "https://yewtu.be/"];

/* SCRIPT START */
let url = new URL(window.location);
let redirectURL = new URL(instances[Math.floor(Math.random()*instances.length)])
let pathname = url.pathname.substring(1);
let videoID = url.searchParams.get("v");
let time = url.searchParams.get("t");

redirectURL.pathname = "/watch";
if(!videoID)
  videoID = pathname;
redirectURL.searchParams.set("v", videoID);
if(time)
  redirectURL.searchParams.set("t", time);

window.location = redirectURL.toString();