Disable DRM

Disable DRM.

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name         Disable DRM
// @namespace    https://greasyfork.org/en/users/85671-jcunews
// @version      1.0.2
// @license      AGPLv3
// @author       jcunews
// @description  Disable DRM.
// @match        *://site-with-fake-drm.nowhere/*
// @grant        unsafeWindow
// @run-at       document-start
// ==/UserScript==

/*
This script is intended for Firefox web browser, but can also be used in Chrome.
When DRM is disabled in Firefox web browser settings, the browser still prompts user to enable DRM when the site requested the DRM's media key.
Some sites don't actually need the media key. i.e. where their video/audio medias are not actually DRM protected.
So, these kind of sites request the media key only for the sake of tracking video views.
This script automatically rejects the media key request so that Firefox don't display the Enable-DRM prompt (which if enabled,
will send a network request to retrieve the media key from the server).
This script must be manually configured for such sites, otherwise it won't do anything.
*/

(window => {
  var rmksa = navigator.requestMediaKeySystemAccess;
  window.navigator.requestMediaKeySystemAccess = function() {
    var rf, pr = new Promise(function(resolve, reject) {
      setTimeout(() => reject(), 20)
    }), pc = pr.catch;
    p.catch = function(fn) {
      rf = fn;
      return pc.apply(this, arguments)
    };
    return pr
  };
})(unsafeWindow)