spotify-adblock

abba23活跃维护

用 LD_PRELOAD 在 Linux 上拦截 Spotify 客户端广告请求的轻量级广告屏蔽库,编译成动态库后无需改客户端即可去广告。

Adblocker for Spotify

v1.1.1发布于 2026-08-12 16:22 UTC2,257star112fork同步于 2026-11-07 07:34 UTC

怎么上手

由 README 提炼,执行前请确认
git clone https://github.com/abba23/spotify-adblock.git && cd spotify-adblock && make
sudo make install
LD_PRELOAD=/usr/local/lib/spotify-adblock.so spotify
硬件要求按 README 说明

README 未说明

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

Linux 上通过 LD_PRELOAD 拦截 Spotify 广告请求的轻量去广告工具

用 LD_PRELOAD 在 Linux 上拦截 Spotify 客户端广告请求的轻量级广告屏蔽库,编译成动态库后无需改客户端即可去广告。

核心能力

  • 包装 cef_urlrequest_create 拦截请求
  • 按 denylist 屏蔽广告 URL
  • 支持 allowlist 与 denylist 配置
  • 提供 Flatpak 安装与启动方式
  • 可生成 .desktop 文件从启动器运行

容易踩的坑

不适用于 snap 版 Spotify;Flatpak 版可能因系统共享库版本不兼容而失效;需先安装 Rust 和 Cargo 才能编译

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

5 个版本v1.1.1
  1. v1.1.1最新正式版2026-08-12 · 2026-08-12 16:22 UTC

    Denylist update to fix adblocking in Spotify 1.2.95.453

  2. v1.1.02026-06-05 · 2026-06-05 15:23 UTC
    查看更新说明
    • Major refactoring (newest Rust edition, minimized included CEF bindings, better logging with colors, code cleanup)
    • Allowlist updates (fixes Discord Rich Presence)
    • Support for configuration according to the XDG Base Directory Specification
    • Flatpak documentation update
  3. v1.0.32023-09-13 · 2023-09-13 19:47 UTC
    查看更新说明
    • Allowlist update
    • Dependencies update
    • Workaround for undefined symbol: cef_string_userfree_utf16_free error when launching Spotify using a wrapper script
  4. v1.0.22022-04-25 · 2022-04-25 10:27 UTC
    查看更新说明

    Allowlist update

  5. v1.0.12022-01-02 · 2022-01-02 09:54 UTC
    查看更新说明

    Allowlist fixes and updates

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    spotify-adblock

    Spotify adblocker for Linux that works by wrapping cef_urlrequest_create and blocking requests to URLs on a denylist.

    Notes

    • This does not work with the snap Spotify package.
    • This might not work with the Flatpak Spotify package, depending on your system's shared libraries' versions.
    • On Debian-based distributions (e.g. Ubuntu), the Debian Spotify package can be installed by following the instructions at the bottom of this page. (recommended)

    Build

    Prerequisites:

    $ git clone https://github.com/abba23/spotify-adblock.git
    $ cd spotify-adblock
    $ make
    

    Install

    $ sudo make install
    
    Flatpak
    $ mkdir -p ~/.spotify-adblock && cp target/release/libspotifyadblock.so ~/.spotify-adblock/spotify-adblock.so
    $ mkdir -p ~/.var/app/com.spotify.Client/config/spotify-adblock && cp config.toml ~/.var/app/com.spotify.Client/config/spotify-adblock
    $ flatpak override --user --filesystem="~/.spotify-adblock/spotify-adblock.so" --filesystem="~/.config/spotify-adblock/config.toml" com.spotify.Client
    

    Usage

    Command-line

    $ LD_PRELOAD=/usr/local/lib/spotify-adblock.so spotify
    
    Flatpak
    $ flatpak run --command=sh com.spotify.Client -c 'eval "$(sed s#LD_PRELOAD=#LD_PRELOAD=$HOME/.spotify-adblock/spotify-adblock.so:#g /app/bin/spotify)"'
    

    Desktop file

    You can integrate it with your desktop environment by creating a .desktop file (e.g. spotify-adblock.desktop) in ~/.local/share/applications. This lets you easily run it from an application launcher without opening a terminal.

    Examples:

    [Desktop Entry]
    Type=Application
    Name=Spotify (adblock)
    GenericName=Music Player
    Icon=spotify-client
    TryExec=spotify
    Exec=env LD_PRELOAD=/usr/local/lib/spotify-adblock.so spotify %U
    Terminal=false
    MimeType=x-scheme-handler/spotify;
    Categories=Audio;Music;Player;AudioVideo;
    StartupWMClass=spotify
    
    [Desktop Entry]
    Type=Application
    Name=Spotify (adblock)
    GenericName=Music Player
    Icon=com.spotify.Client
    Exec=flatpak run --file-forwarding --command=sh com.spotify.Client -c 'eval "$(sed s#LD_PRELOAD=#LD_PRELOAD=$HOME/.spotify-adblock/spotify-adblock.so:#g /app/bin/spotify)"' @@u %U @@
    Terminal=false
    MimeType=x-scheme-handler/spotify;
    Categories=Audio;Music;Player;AudioVideo;
    StartupWMClass=spotify
    

    Uninstall

    $ sudo make uninstall
    
    Flatpak
    $ rm -r ~/.spotify-adblock ~/.config/spotify-adblock
    $ flatpak override --user --reset com.spotify.Client
    

    Configuration

    The allowlist and denylist are configured in a config file located at /etc/spotify-adblock/config.toml. It can be overriden with a user-specific version at $XDG_CONFIG_HOME/spotify-adblock/config.toml or $HOME/.config/spotify-adblock/config.toml.