@thieum/hushad
v1.2.0
Published
Spotify and Deezer ad blocker for Linux: one command, no client patching, no root.
Maintainers
Readme
hushad
Spotify and Deezer ad blocker for Linux: one command, no client patching, no root.
hushad spotify (or hushad deezer) starts the desktop client through a local mitmproxy filter that blocks ad requests by full URL. Spotify works as a snap, a Flatpak or the official .deb. Deezer has no official Linux client: hushad supports the unofficial deezer-desktop snap.
npx @thieum/hushad@latest # checks prerequisites, installs, sets everything up
hushad spotify # Spotify, minus the ads
hushad deezer # Deezer, minus the ads
hushad # whichever of the two is installedHow it works
- The app is told to use a proxy on
127.0.0.1:8899: Spotify in its ownprefsfile, Deezer with--proxy-serveron its command line. - hushad starts
mitmdumpon that port with a small filter (filter.py). - mitmproxy's certificate goes into the app's NSS certificate store, never the system one. This lets the proxy read full request URLs inside HTTPS. With a snap or a Flatpak, that store belongs to the app alone, so only the app trusts the certificate. The Spotify .deb has no store of its own: see the .deb caveat.
- Requests matching a rule, such as
gew1-spclient.spotify.com/ad-logic/prefetchfor Spotify, or the Google IMA ad player andcdn-content.dzcdn.net/ads/for Deezer, get an empty403. The app never receives the ad, so the music just keeps playing.
Blocked requests never reach the servers: mitmproxy runs in lazy mode and only connects upstream for allowed requests.
Deezer: the cache is emptied at each start
hushad deezerempties two Deezer caches before starting it:Cache/Cache_DataandService Worker/CacheStoragein Deezer's data folder.Deezer keeps the ads it has already downloaded there, and plays them again from disk, without any request the proxy could block. An ad cached once (before installing hushad, or after
hushad off) would come back at every ad break. These caches only hold downloaded web files: your account, settings and music library are not touched.hushad doctortells you when an ad is waiting in the cache.
Install
npx @thieum/hushad@latest # interactive
npx @thieum/hushad@latest -y # say yes to every install offerThe installer checks each prerequisite and offers to install what is missing (with sudo when a system package is needed):
| Prerequisite | Why | Installed with |
|---|---|---|
| Linux | Spotify / Deezer desktop for Linux | — |
| Node.js ≥ 18 | runs hushad | — |
| Spotify desktop (snap, Flatpak or .deb) and/or Deezer (deezer-desktop snap) | auto-detected, one is enough | — |
| pgrep | detects a running Spotify or Deezer | procps |
| Python 3 | needed by mitmproxy | apt / dnf / pacman / zypper |
| mitmproxy ≥ 9 | the proxy | pipx install mitmproxy |
| certutil | trusts the certificate for each app | libnss3-tools / nss-tools / nss |
Files go to ~/.local/share/hushad (app, rules, log), and the hushad command goes to ~/.local/bin. No root access is needed besides installing missing system packages.
Usage
hushad start the installed app (with both, says which command to run)
hushad spotify [args] start Spotify through the ad-blocking proxy
hushad deezer [args] start Deezer through the ad-blocking proxy
hushad spotify --watch same, and show every request live (red = blocked)
hushad urls [N] most frequent requests seen (host + path)
hushad stats blocked ad requests
hushad log follow requests live (in another terminal)
hushad clear clear the request log
hushad edit edit the blocking rules
hushad cert (re)trust the mitmproxy certificate for Spotify and Deezer
hushad status current state
hushad doctor check prerequisites and installation
hushad off restore Spotify and Deezer (remove proxy setting and certificate)
hushad uninstall remove hushadQuit the app before running hushad spotify or hushad deezer. If it is already running, it keeps its old network settings.
Another Deezer install than the snap can be used with DEEZER_CMD (how to start it), DEEZER_NSSDB (its NSS certificate store) and DEEZER_CONFIG (its data folder, which holds the caches).
Rules
~/.local/share/hushad/rules.txt holds one regular expression per line, matched against host/path with the query string removed:
spclient\.spotify\.com/ad-logic/
spclient\.spotify\.com/ads/
doubleclick\.net/To find a new ad endpoint, run hushad clear then hushad spotify --watch (or hushad deezer --watch), note what appears when an ad plays, and add it with hushad edit. Reinstalling keeps your rules file and adds only the rule sections it does not have yet, such as the Deezer section after an upgrade. Telemetry rules (gabo-receiver-service) are included but commented out.
Privacy & safety
- The log only stores the host and path. Query strings, where Spotify's access tokens live, are never written. Past 5 MB it moves to
requests.log.1when the proxy starts. ~/.mitmproxyholds a private key that can decrypt Spotify's and Deezer's traffic on this machine. Never share it.- Spotify .deb: the certificate is trusted beyond Spotify. The .deb uses
~/.pki/nssdb, the certificate store shared by Chrome, Chromium and Electron apps (Slack, Discord, VS Code…) for your user. Untilhushad off, they all trust the mitmproxy certificate for every site, even when hushad is not running: anyone who gets the key in~/.mitmproxycould then intercept their HTTPS traffic. Firefox and the system store are not affected. Prefer the Spotify snap or Flatpak, which have their own store; the installer andhushad doctorwarn about this. hushad offremoves both the proxy setting and the certificate. For snaps, it cleans every revision snap keeps, sosnap revertstays safe.
Limits
- Spotify also uses a proprietary protocol (
ap-*.spotify.com:4070) that mitmproxy cannot read. If Spotify ever moves ad delivery there, URL rules will stop working. - A snap refresh changes the app's data folder. If Spotify or Deezer can't connect after an update, run
hushad cert. - The Deezer client is an unofficial port. If a new version stops honoring
--proxy-server, or fetches ads from another address, the rules need updating. - Blocking ads goes against Spotify's and Deezer's terms of use. Use at your own risk.
License
MIT
