Last active
December 3, 2022 11:30
-
-
Save bogenpirat/54aa60d78ccae23cbad4ff17b4e0b35c to your computer and use it in GitHub Desktop.
short script to redirect blocked youtube videos to youpak which usually works great.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name youtube blocked video redirector | |
// @namespace http://tampermonkey.net/ | |
// @version 0.3 | |
// @description if a video is blocked, embed the same video from a non-blocking site | |
// @author bog | |
// @match https://www.youtube.com/watch?v=* | |
// @grant none | |
// @run-at document-idle | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
if(document.querySelector("#player-unavailable").getBoundingClientRect().width !== 0) { | |
var embedUrl = window.location.toString(); | |
embedUrl = embedUrl.replace("youtube", "youpak"); | |
embedUrl = embedUrl.replace("/watch", "/embed"); | |
embedUrl += "&autoplay=true"; | |
for(let elm of document.querySelectorAll("#player-unavailable > *")) elm.remove(); | |
document.querySelector("#player-unavailable").insertAdjacentHTML('afterbegin', '<iframe style="width: 100%; height: 100%" src="' + embedUrl.toString() + '" frameborder="0" allowfullscreen></iframe>'); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment