Debugging Tools¶
The debug directory contains two utilities for testing Spotify token retrieval and reading current TOTP values. Most users do not need these tools.
Access Token Retrieval via sp_dc Cookie and TOTP¶
The spotify_monitor_totp_test requests a Spotify access token with a Web Player sp_dc cookie and TOTP parameters.
Download the file in a browser or run:
curl -fsSLO https://raw.githubusercontent.com/misiektoja/spotify_monitor/refs/heads/main/debug/spotify_monitor_totp_test.py
Install requirements:
Run:
The command prints the access token response. Example output:
If the included TOTP values stop working:
--fetch-secretsopens Spotify Web Player in a headless Playwright browser and extracts current values.--download-secretsreadsSECRET_CIPHER_DICT_URLfrom an HTTP URL or localfile:URL. Its default source is xyloflake/spot-secrets-go. These options affect only this test utility. The main Spotify Monitor tool usesTOTP_VERSIONandTOTP_SECRET_CIPHER_BYTESinstead.
Secret Key Extraction from Spotify Web Player Bundles¶
The spotify_monitor_secret_grabber reads TOTP keys from Spotify Web Player JavaScript bundles. It scans the loaded source first and keeps the older runtime hook as a fallback.
The extractor can return v59, v60 and v61 from the current web-player bundle even when the older runtime hook finds nothing.
Recommended: Use the Docker method if you do not already have Playwright and its browser files installed.
Download the file in a browser or run:
curl -fsSLO https://raw.githubusercontent.com/misiektoja/spotify_monitor/refs/heads/main/debug/spotify_monitor_secret_grabber.py
Install requirements:
Run interactively (default output mode):
Example output:
Show help:
CLI Output Modes¶
Choose the output format with one of these options:
| Flag | Description | Output |
|---|---|---|
--secret |
Prints plain JSON array of extracted secrets | [{"version": X, "secret": "..."}, ...] |
--secretbytes |
Prints JSON array with ASCII byte values | [{"version": X, "secret": [..]}, ...] |
--secretdict |
Prints JSON object/dict mapping version → byte list | {"X": [..], "Y": [..]} |
--all |
Extracts secrets and writes all three outputs to local files | secrets.json, secretBytes.json, secretDict.json |
Save the version-to-byte mapping as JSON:
Generate all three output files at once:
Default file paths and names can be configured directly in the OUTPUT_FILES dictionary at the top of the script.
Secret Key Extraction via Docker¶
A prebuilt multi-architecture image is available on Docker Hub: misiektoja/spotify-secrets-grabber
The examples use the latest tag. --pull=always in direct commands and pull_policy: always in Compose make Docker check for a newer image before each run. To stay on one release, add a version such as :1.3 to the image name.
This image works on:
- macOS (Intel & Apple Silicon)
- Linux (x86_64 and ARM64)
- Windows with a Docker-compatible runtime
- Raspberry Pi 4/5 (64-bit OS)
Run interactively (default output mode):
Show help:
Save the version-to-byte mapping as JSON:
Generate all three output files at once:
For SELinux hosts (Fedora/RHEL), use -v .:/work:Z.
To use Docker Compose, run the included compose.yaml:
Run the command from the directory that contains compose.yaml. The .:/work mount saves generated files in that host directory.
Use the generated secretDict.json with spotify_monitor_totp_test. The main Spotify Monitor tool reads its values from TOTP_VERSION and TOTP_SECRET_CIPHER_BYTES. If Spotify selects a new TOTP version, update those settings with the values from the current web-player bundle.