Skip to content

Instantly share code, notes, and snippets.

@evanreichard
Last active July 27, 2023 14:10
Show Gist options
  • Save evanreichard/8db561c7be7a6c308db18ce3e983c8d6 to your computer and use it in GitHub Desktop.
Save evanreichard/8db561c7be7a6c308db18ce3e983c8d6 to your computer and use it in GitHub Desktop.
yattee-redirect.user.js
// ==UserScript==
// @name Yattee Redirect
// @version 0.0.3
// @updateURL https://gist.github.com/evanreichard/8db561c7be7a6c308db18ce3e983c8d6/raw/yattee-redirect.user.js
// @match https://www.youtube.com/*
// @match https://m.youtube.com/*
// @grant none
// @noframes
// @run-at document-start
// ==/UserScript==
function attemptRedirect(){
if (document.location.pathname == "/watch") {
let newPath = document.location.href.split("https://" + document.location.host + "/")[1];
document.location.href = "yattee://" + newPath
}
}
var pushState = history.pushState;
history.pushState = function () {
pushState.apply(history, arguments);
attemptRedirect();
};
attemptRedirect();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment