Ad Skipper for Spotify Web Player

Automatically skip ads on Spotify.

Från och med 2025-06-19. Se den senaste versionen.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Ad Skipper for Spotify Web Player
// @namespace    http://tampermonkey.net/
// @version      1.1.0
// @description  Automatically skip ads on Spotify.
// @author       Tomoyuki Kawao
// @match        https://open.spotify.com/*
// @license      MIT
// @grant        none
// @run-at       document-start
// ==/UserScript==

document.createElement = function(originalCreateElement) {
    return function() {
        var element = originalCreateElement.apply(this, arguments);
        if (element instanceof HTMLMediaElement) {
            element.addEventListener("play", (event) => {
                if (!event.currentTarget.src.startsWith("blob:https://open.spotify.com/") && event.currentTarget.duration < 40.0) {
                    event.currentTarget.currentTime = event.currentTarget.duration - 0.1;
                }
            });
        }
        return element;
    };
}(document.createElement);