Spotify Wrapped Farming

Automatically skip songs on Spotify Web Player after a random interval between 75 to 90 seconds, then repeat.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         Spotify Wrapped Farming
// @namespace    https://greasyfork.org/en/users/1464319
// @version      2025.05.01
// @description  Automatically skip songs on Spotify Web Player after a random interval between 75 to 90 seconds, then repeat.
// @author       Lin808
// @match        https://open.spotify.com/*
// @grant        none
// @run-at       document-idle
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    function getRandomInt(min, max) {
        min = Math.ceil(min);
        max = Math.floor(max);
        return Math.floor(Math.random() * (max - min) + min);
    }

    function doSkip() {
        // Spotify "Next" button usually has aria-label="Next"
        var button = document.querySelector('button[aria-label="Next"]');
        if(button) {
            button.click();
            console.log('Skipped song at', new Date().toLocaleTimeString());
        } else {
            console.log('Next button not found');
        }
    }

    (function loop() {
        var rand = getRandomInt(75000, 90000);
        console.log('Next skip in (ms):', rand);
        setTimeout(function() {
            doSkip();
            loop();
        }, rand);
    }());

})();