fix(music): add spotify-tokener with Chromium for Partner API anonymous tokens

Spotify changed their API in Feb 2026 - playlists now require anonymous
tokens via the Partner API. The default anonymous token endpoint is
blocked from server IPs. Added a custom Dockerfile for spotify-tokener
with Chromium installed, and configured LavaSrc to use Partner API with
the tokener endpoint. Playlists now load successfully.
This commit is contained in:
loki5512344 2026-08-31 16:19:30 +02:00
parent 9aebef15e1
commit af88cea301
Signed by: boba
GPG key ID: 253067914055423B
3 changed files with 20 additions and 2 deletions

View file

@ -1,8 +1,19 @@
services: services:
spotify-tokener:
build:
context: ./lavalink
dockerfile: Dockerfile.tokener
container_name: spotify-tokener
restart: unless-stopped
environment:
- SPOTIFY_TOKENER_CHROME_PATH=/usr/bin/chromium
lavalink: lavalink:
image: ghcr.io/lavalink-devs/lavalink:4-alpine image: ghcr.io/lavalink-devs/lavalink:4-alpine
container_name: loki-lavalink container_name: loki-lavalink
restart: unless-stopped restart: unless-stopped
depends_on:
- spotify-tokener
ports: ports:
- "127.0.0.1:2333:2333" - "127.0.0.1:2333:2333"
volumes: volumes:
@ -13,7 +24,6 @@ services:
JAVA_OPTS: "-Xmx1G -Xms256M" JAVA_OPTS: "-Xmx1G -Xms256M"
SPOTIFY_CLIENT_ID: ${SPOTIFY_CLIENT_ID} SPOTIFY_CLIENT_ID: ${SPOTIFY_CLIENT_ID}
SPOTIFY_CLIENT_SECRET: ${SPOTIFY_CLIENT_SECRET} SPOTIFY_CLIENT_SECRET: ${SPOTIFY_CLIENT_SECRET}
PLUGINS_LAVASRC_SPOTIFY_PREFERPARTNERAPI: "true"
healthcheck: healthcheck:
test: ["CMD-SHELL", "wget -q -O /dev/null --header=Authorization:Hch4HiVCxkKs9JPiSnrt4Q http://localhost:2333/v4/info || exit 1"] test: ["CMD-SHELL", "wget -q -O /dev/null --header=Authorization:Hch4HiVCxkKs9JPiSnrt4Q http://localhost:2333/v4/info || exit 1"]
interval: 30s interval: 30s

View file

@ -0,0 +1,6 @@
FROM ghcr.io/topi314/spotify-tokener:master
RUN apt-get update && \
apt-get install -y --no-install-recommends chromium && \
rm -rf /var/lib/apt/lists/*
ENV SPOTIFY_TOKENER_CHROME_PATH=/usr/bin/chromium
ENV CHROMIUM_FLAGS="--no-sandbox --disable-gpu --headless"

View file

@ -25,10 +25,12 @@ plugins:
spotify: spotify:
clientId: "${SPOTIFY_CLIENT_ID}" clientId: "${SPOTIFY_CLIENT_ID}"
clientSecret: "${SPOTIFY_CLIENT_SECRET}" clientSecret: "${SPOTIFY_CLIENT_SECRET}"
spDc: "AQDVrLVOyLLT3ZuiLoY32uH8HotvY_Lw67ay1lejf55S7O3f_O9IefxZ8XDf3pYklpwl5Klei2NeYUPRZ-cbkpQg5S3RyMjuiTmBxdAuMlugA61_wAy-bXD979aYDK44Bid6UKxLHjh0kFQZ_tX71DAUGezA2XjeLcRi_-TLcKHWKZVKPhGniUOZZEhg2Ij9t6valbqSbDOQ1t0dtQ"
countryCode: "RU" countryCode: "RU"
playlistLoadLimit: 10 playlistLoadLimit: 10
albumLoadLimit: 10 albumLoadLimit: 10
preferPartnerApi: true preferPartnerApi: true
customTokenEndpoint: "http://spotify-tokener:8080/api/token"
applemusic: applemusic:
countryCode: "RU" countryCode: "RU"
mediaType: "music" mediaType: "music"
@ -55,4 +57,4 @@ logging:
level: level:
root: INFO root: INFO
lavalink: INFO lavalink: INFO
com.github.topi314.lavasrc: DEBUG com.github.topi314.lavasrc: INFO