您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Forwards YouTube links to the youtube.com/embed/* page, so there's just the video in your window and nothing else.
// ==UserScript== // @name YouTube /embed/ forwarder // @description Forwards YouTube links to the youtube.com/embed/* page, so there's just the video in your window and nothing else. // @namespace https://greasyfork.org/en/users/1148791-vuccala // @author Vuccala // @icon https://archive.org/download/yt_icon/yt.png // @match *://*.youtube.com/* // @match *://*.youtu.be/* // @run-at document-start // @version 0.5 // @grant none // @license MIT // ==/UserScript== (function () { const embedBaseUrl = 'https://www.youtube.com/embed/'; function getId(u) { const idMatch = /(?:[?&]v=|\/(?:embed\/|v\/|shorts\/))([^&?/]+)/.exec(u); return idMatch ? idMatch[1] : ''; } function createSpoofPage(embedUrl) { const html = ` <html style="background-color: #000;"> <head> <meta http-equiv="refresh" content="0; url='${embedUrl}'" /> <meta name="referrer" content="origin" /> </head> <body style="background-color: #000; color: #aaa;"> <p>Redirecting to YouTube embed...</p> </body> </html> `; const blob = new Blob([html], { type: 'text/html' }); return URL.createObjectURL(blob); } const url = window.location.href; if (url.includes('/watch?v=') || url.includes('/shorts/') || url.includes('/watch?app=desktop&v=')) { const videoId = getId(url); const embedUrl = embedBaseUrl + videoId; if (embedUrl !== url) { const spoofPage = createSpoofPage(embedUrl); window.location.href = spoofPage; } } })();