Skip to content

Instantly share code, notes, and snippets.

@karakufire
Created November 2, 2023 15:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save karakufire/48753b30df160db31e65e368fb8f8592 to your computer and use it in GitHub Desktop.
Save karakufire/48753b30df160db31e65e368fb8f8592 to your computer and use it in GitHub Desktop.
Redirect watch to embed
// ==UserScript==
// @name Redirect watch to embed
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Redirect watch url to embed url.
// @author karakufire
// @match https://www.youtube.com/watch?v=*
// @icon https://www.google.com/s2/favicons?sz=64&domain=youtube.com
// ==/UserScript==
(function() {
'use strict';
const videoID = document.location.toString().match(/(?:https?:\/\/www\.youtube\.com\/watch\?).*((?<=&?v=)[\w-]+).*/)[1];
document.location.replace(`https://www.youtube.com/embed/${videoID}`);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment