Spotify Silent Ads

Mute audio when Spotify ads are detected

目前為 2025-01-20 提交的版本,檢視 最新版本

// ==UserScript==
// @name         Spotify Silent Ads
// @name:zh-CN   Spotify 静音广告
// @namespace    https://gf.qytechs.cn/users/166541
// @version      0.0.1
// @description  Mute audio when Spotify ads are detected
// @description:zh-cn 当检测到 Spotify 广告时,对音频静音
// @author       xmdhs
// @match        https://open.spotify.com/*
// @license      MIT
// @icon         https://www.google.com/s2/favicons?sz=64&domain=open.spotify.com
// ==/UserScript==

let title = document.title;
let muted = false;

Object.defineProperty(document, 'title', {
    get() {
        return title;
    },
    set(newTitle) {
        const muteButton = document.querySelector('[data-testid="volume-bar-toggle-mute-button"]');
        if (newTitle.includes("Spotify – 广告") || muted) {
            muteButton.click();
            muted = !muted
            if (muted) {
                console.log(newTitle, "静音")
            }
        }
    }
});

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址