ersatz wrote: ↑27 Mar 2025, 00:24
Sidenote: I was also encountering a bug in the 133 build in which youtube playback wasn't functioning properly, but it looks like that's been fixed in this version. \(^▽^)/
There's a
fix for that (below).
YouTube is basically using
WebGL (fingerprinting?) and performs tests for *valid* WebGL data.
Official Ungoogled used to send *invalid* (ie, "blank"/"empty") WebGL data and YouTube "caught on".
There are forks out there that
make this same MISTAKE with
clienthints, you should *NOT* send "blank" / "empty" data !!!
"Blank" / "Empty" is a GIGANTIC FINGERPRINT in-and-of-itself!
Fix for YouTube on v133 -
// ==UserScript==
// @name - YouTube 03 - Workaround and H264ify
// @version 2025-02-27
// @match
https://www.youtube.com/*
// @match *://*.youtube.com/*
// @match *://*.youtube-nocookie.com/*
// @match *://*.youtu.be/*
// @run-at document-start
// @grant none
// ==/UserScript==
(function () {
"use strict";
const h264ifyEnable = true;
const h264ifyBlock60fps = false;
const originalGetContext = HTMLCanvasElement.prototype.getContext;
HTMLCanvasElement.prototype.getContext = function (contextType) {
if (contextType === "webgl" || contextType === "webgl2") {
console.log("WebGL is disabled by Tampermonkey");
return null;
}
return originalGetContext.apply(this, arguments);
};
if (!h264ifyEnable) {
return;
}
function override() {
var videoElem = document.createElement('video');
var origCanPlayType = videoElem.canPlayType.bind(videoElem);
videoElem.__proto__.canPlayType = makeModifiedTypeChecker(origCanPlayType);
var mse = window.MediaSource;
if (mse === undefined) return;
var origIsTypeSupported = mse.isTypeSupported.bind(mse);
mse.isTypeSupported = makeModifiedTypeChecker(origIsTypeSupported);
}
function makeModifiedTypeChecker(origChecker) {
return function (type) {
if (!type) return '';
var disallowed_types = ['webm', 'vp8', 'vp9', 'av01'];
for (var i = 0; i < disallowed_types.length; i++) {
if (type.includes(disallowed_types
)) return '';
}
if (h264ifyBlock60fps) {
var match = /framerate=(\d+)/.exec(type);
if (match && parseInt(match[1], 10) > 30) return '';
}
return origChecker(type);
};
}
override();
})();