Skip to content

Instantly share code, notes, and snippets.

@trojkat
Created October 11, 2024 14:21
Show Gist options
  • Save trojkat/1c0f84dc7df8cc038e15f9bb7fb829f3 to your computer and use it in GitHub Desktop.
Save trojkat/1c0f84dc7df8cc038e15f9bb7fb829f3 to your computer and use it in GitHub Desktop.
Invidious YT iframe workaround
// ==UserScript==
// @name Invidious YT iframe
// @namespace http://tampermonkey.net/
// @version 2024-10-02
// @description Temporary workaround
// @author You
// @match https://your-invidious-instance.com/watch*
// ==/UserScript==
(function() {
'use strict';
let VideoID = document.querySelector('#contents .h-box ul li a').getAttribute('href').replace('/watch?v=', '');
let box = document.querySelector('#contents .h-box');
box.innerHTML = '<iframe width="100%" height="800" src="https://www.youtube.com/embed/' + VideoID + '" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>';
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment