// ==UserScript== // @name Deezer Audio Ad Blocker (origin) // @namespace…
- User
// ==UserScript== // @name Deezer Audio Ad Blocker (origin) // @namespace http://tampermonkey.net/ // @version 0.3 // @description Blocks audio ads on Deezer's free version // @author You (with a little help from me) // @match https://www.deezer.com/* // @grant none // ==/UserScript==
(function() { 'use strict';
// Override HTMLMediaElement APIs to block ad playback HTMLMediaElement.prototype.play = function() { if (this.src && this.src.match(/https?://(www|cdn).deezer.com/api/ad/v1/audio/playback/)) { return; } return HTMLMediaElement.prototype.play.apply(this, arguments); };
HTMLMediaElement.prototype.load = function() { if (this.src && this.src.match(/https?://(www|cdn).deezer.com/api/ad/v1/audio/playback/)) { return; } return HTMLMediaElement.prototype.load.apply(this, arguments); };
// Prevent ad elements from being created document.addEventListener('DOMSubtreeModified', function() { var adElements = document.querySelectorAll('audio[src*="deezer.com/api/ad/v1/audio/playback/"]'); adElements.forEach(function(ad) { ad.parentNode.removeChild(ad); }); }); })();
- Assistant
This userscript, named "Deezer Audio Ad Blocker (origin)", is designed to block audio ads on the free version of Deezer by manipulating the browser's HTMLMediaElement APIs and monitoring the DOM for ad elements. Here's a breakdown of what it does:
-
Override
play()andload()Methods:- The script overrides the
play()andload()methods ofHTMLMediaElement(which includes audio and video elements). This is done to prevent any media element from playing or loading if its source URL matches a pattern that indicates it's an ad audio file hosted on Deezer's API.
- The script overrides the
-
- User
update the script to make it functional
- Assistant
- User
does not work. still audio ads. imagine a very new one
- Assistant
I understand. Here's a completely new approach to block audio ads on Deezer using a userscript. This script uses a combination of intercepting network requests and manipulating the DOM to prevent ad audio playback.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.