spotify-monitor 2.1.1__py3-none-any.whl → 2.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of spotify-monitor might be problematic. Click here for more details.
- {spotify_monitor-2.1.1.dist-info → spotify_monitor-2.2.dist-info}/METADATA +40 -40
- spotify_monitor-2.2.dist-info/RECORD +7 -0
- spotify_monitor.py +393 -240
- spotify_monitor-2.1.1.dist-info/RECORD +0 -7
- {spotify_monitor-2.1.1.dist-info → spotify_monitor-2.2.dist-info}/WHEEL +0 -0
- {spotify_monitor-2.1.1.dist-info → spotify_monitor-2.2.dist-info}/entry_points.txt +0 -0
- {spotify_monitor-2.1.1.dist-info → spotify_monitor-2.2.dist-info}/licenses/LICENSE +0 -0
- {spotify_monitor-2.1.1.dist-info → spotify_monitor-2.2.dist-info}/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: spotify_monitor
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.2
|
|
4
4
|
Summary: Tool implementing real-time tracking of Spotify friends music activity
|
|
5
5
|
Author-email: Michal Szymanski <misiektoja-pypi@rm-rf.ninja>
|
|
6
6
|
License-Expression: GPL-3.0-or-later
|
|
@@ -29,10 +29,6 @@ spotify_monitor is a tool for real-time monitoring of Spotify friends' music act
|
|
|
29
29
|
|
|
30
30
|
NOTE: If you're interested in tracking changes to Spotify users' profiles including their playlists, take a look at another tool I've developed: [spotify_profile_monitor](https://github.com/misiektoja/spotify_profile_monitor).
|
|
31
31
|
|
|
32
|
-
> Spotify made multiple changes to the web endpoint on June 10th 2025, which broke the **[sp_dc cookie](#spotify-sp_dc-cookie)** method.
|
|
33
|
-
> 📦 The issue is under investigation to determine if it can be restored.
|
|
34
|
-
> 👉 In the meantime, use **[desktop client](#spotify-desktop-client)** method instead.
|
|
35
|
-
|
|
36
32
|
<a id="features"></a>
|
|
37
33
|
## Features
|
|
38
34
|
|
|
@@ -44,6 +40,7 @@ NOTE: If you're interested in tracking changes to Spotify users' profiles includ
|
|
|
44
40
|
- Saving all listened songs with timestamps to the CSV file
|
|
45
41
|
- Clickable Spotify, Apple Music, YouTube Music and Genius Lyrics search URLs printed in the console & included in email notifications
|
|
46
42
|
- Displaying basic statistics for the user's playing session (duration, time span, number of listened and skipped songs, songs on loop)
|
|
43
|
+
- Support for two different methods to get a Spotify access token (`sp_dc cookie`, `desktop client`)
|
|
47
44
|
- Possibility to control the running copy of the script via signals
|
|
48
45
|
|
|
49
46
|
<p align="center">
|
|
@@ -160,65 +157,64 @@ spotify_monitor --generate-config > spotify_monitor.conf
|
|
|
160
157
|
Edit the `spotify_monitor.conf` file and change any desired configuration options (detailed comments are provided for each).
|
|
161
158
|
|
|
162
159
|
<a id="spotify-access-token-source"></a>
|
|
163
|
-
|
|
160
|
+
### Spotify access token source
|
|
164
161
|
|
|
165
162
|
The tool supports two methods for obtaining a Spotify access token.
|
|
166
163
|
|
|
167
164
|
It can be configured via the `TOKEN_SOURCE` configuration option or the `--token-source` flag.
|
|
168
165
|
|
|
169
|
-
|
|
166
|
+
**Recommended: `cookie`**
|
|
170
167
|
|
|
171
|
-
|
|
168
|
+
Uses the `sp_dc` cookie to retrieve a token from the Spotify web endpoint. This method is easy to set up and recommended for most users.
|
|
172
169
|
|
|
173
|
-
|
|
170
|
+
**Alternative: `client`**
|
|
174
171
|
|
|
175
|
-
|
|
176
|
-
#### Spotify sp_dc Cookie
|
|
172
|
+
Uses captured credentials from the Spotify desktop client and a Protobuf-based login flow. It's more complex to set up and intended for advanced users who want a long-lasting token with the broadest possible access.
|
|
177
173
|
|
|
178
|
-
|
|
174
|
+
If no method is specified, the tool defaults to the `cookie` method.
|
|
179
175
|
|
|
180
|
-
|
|
176
|
+
**Important**: It is strongly recommended to use a separate Spotify account with this tool. It does not rely on the official Spotify Web API for core features (like fetching friend activity), as it is not supported by the public API. That said, while I've never encountered any issues on my own accounts, I can't guarantee that Spotify won't impose restrictions in the future - you've been warned.
|
|
181
177
|
|
|
182
|
-
|
|
178
|
+
<a id="spotify-sp_dc-cookie"></a>
|
|
179
|
+
#### Spotify sp_dc Cookie
|
|
183
180
|
|
|
184
|
-
|
|
181
|
+
This is the default method used to obtain a Spotify access token.
|
|
185
182
|
|
|
186
|
-
|
|
187
|
-
- Pass it at runtime with `-u` / `--spotify-dc-cookie`
|
|
188
|
-
- Set it as an [environment variable](#storing-secrets) (e.g. `export SP_DC_COOKIE=...`)
|
|
189
|
-
- Add it to [.env file](#storing-secrets) (`SP_DC_COOKIE=...`) for persistent use
|
|
183
|
+
- Log in to [https://open.spotify.com/](https://open.spotify.com/) in your web browser.
|
|
190
184
|
|
|
191
|
-
|
|
192
|
-
|
|
185
|
+
- Locate and copy the value of the `sp_dc` cookie.
|
|
186
|
+
- Use your web browser's dev console or **Cookie-Editor** by cgagnier to extract it easily: [https://cookie-editor.com/](https://cookie-editor.com/)
|
|
193
187
|
|
|
194
|
-
|
|
188
|
+
- Provide the `SP_DC_COOKIE` secret using one of the following methods:
|
|
189
|
+
- Pass it at runtime with `-u` / `--spotify-dc-cookie`
|
|
190
|
+
- Set it as an [environment variable](#storing-secrets) (e.g. `export SP_DC_COOKIE=...`)
|
|
191
|
+
- Add it to [.env file](#storing-secrets) (`SP_DC_COOKIE=...`) for persistent use
|
|
192
|
+
- Fallback: hard-code it in the code or config file
|
|
195
193
|
|
|
196
|
-
If
|
|
194
|
+
If your `sp_dc` cookie expires, the tool will notify you via the console and email. In that case, you'll need to grab the new `sp_dc` cookie value.
|
|
197
195
|
|
|
198
|
-
|
|
196
|
+
If you store the `SP_DC_COOKIE` in a dotenv file you can update its value and send a `SIGHUP` signal to reload the file with the new `sp_dc` cookie without restarting the tool. More info in [Storing Secrets](#storing-secrets) and [Signal Controls (macOS/Linux/Unix)](#signal-controls-macoslinuxunix).
|
|
199
197
|
|
|
200
198
|
<a id="spotify-desktop-client"></a>
|
|
201
199
|
#### Spotify Desktop Client
|
|
202
200
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
Run an intercepting proxy of your choice (like [Proxyman](https://proxyman.com)).
|
|
201
|
+
This is the alternative method used to obtain a Spotify access token which simulates a login from the real Spotify desktop app using credentials intercepted from a real session.
|
|
206
202
|
|
|
207
|
-
|
|
203
|
+
- Run an intercepting proxy of your choice (like [Proxyman](https://proxyman.com)).
|
|
208
204
|
|
|
209
|
-
|
|
205
|
+
- Launch the Spotify desktop client and look for POST requests to `https://login{n}.spotify.com/v3/login`
|
|
206
|
+
- Note: The `login` part is suffixed with one or more digits (e.g. `login5`).
|
|
210
207
|
|
|
211
|
-
If you don't see this request, log out from the client and log back in.
|
|
208
|
+
- If you don't see this request, log out from the Spotify desktop client and log back in.
|
|
212
209
|
|
|
213
|
-
Export the login request body (a binary Protobuf payload) to a file.
|
|
214
|
-
|
|
215
|
-
In Proxyman: ***right click the request → Export → Request Body → Save File***.
|
|
210
|
+
- Export the login request body (a binary Protobuf payload) to a file (e.g. ***login-request-body-file***)
|
|
211
|
+
- In Proxyman: **right click the request → Export → Request Body → Save File**.
|
|
216
212
|
|
|
217
213
|
<p align="center">
|
|
218
214
|
<img src="https://raw.githubusercontent.com/misiektoja/spotify_monitor/refs/heads/main/assets/proxyman_export_protobuf.png" alt="proxyman_export_protobuf" width="80%"/>
|
|
219
215
|
</p>
|
|
220
216
|
|
|
221
|
-
|
|
217
|
+
- Run the tool with `--token-source client -w <path-to-login-request-body-file>`:
|
|
222
218
|
|
|
223
219
|
```sh
|
|
224
220
|
spotify_monitor --token-source client -w <path-to-login-request-body-file> <spotify_user_uri_id>
|
|
@@ -226,15 +222,17 @@ spotify_monitor --token-source client -w <path-to-login-request-body-file> <spot
|
|
|
226
222
|
|
|
227
223
|
If successful, the tool will automatically extract the necessary fields and begin monitoring.
|
|
228
224
|
|
|
229
|
-
|
|
225
|
+
Instead of using the `-w` flag each time, you can persist the Protobuf login request file path by setting the `LOGIN_REQUEST_BODY_FILE` configuration option.
|
|
226
|
+
|
|
227
|
+
The same applies to `--token-source client` flag - you can persist it via `TOKEN_SOURCE` configuration option set to `client`.
|
|
230
228
|
|
|
231
229
|
The tool will automatically refresh both the access token and client token using the intercepted refresh token.
|
|
232
230
|
|
|
233
|
-
|
|
231
|
+
If your refresh token expires, the tool will notify you via the console and email. In that case, you'll need to re-export the login request body.
|
|
234
232
|
|
|
235
|
-
|
|
233
|
+
If you re-export the login request body to the same file name, you can send a `SIGHUP` signal to reload the file with the new refresh token without restarting the tool. More info in [Signal Controls (macOS/Linux/Unix)](#signal-controls-macoslinuxunix).
|
|
236
234
|
|
|
237
|
-
|
|
235
|
+
Advanced options are available for further customization - refer to the configuration file comments. However, the default settings are suitable for most users and modifying other values is generally NOT recommended.
|
|
238
236
|
|
|
239
237
|
<a id="following-the-monitored-user"></a>
|
|
240
238
|
### Following the Monitored User
|
|
@@ -273,12 +271,13 @@ spotify_monitor --send-test-email
|
|
|
273
271
|
<a id="storing-secrets"></a>
|
|
274
272
|
### Storing Secrets
|
|
275
273
|
|
|
276
|
-
It is recommended to store secrets like `SP_DC_COOKIE` or `SMTP_PASSWORD` as either an environment variable or in a dotenv file.
|
|
274
|
+
It is recommended to store secrets like `SP_DC_COOKIE`, `REFRESH_TOKEN` or `SMTP_PASSWORD` as either an environment variable or in a dotenv file.
|
|
277
275
|
|
|
278
|
-
Set environment variables using `export` on **Linux/Unix/macOS/WSL** systems:
|
|
276
|
+
Set the needed environment variables using `export` on **Linux/Unix/macOS/WSL** systems:
|
|
279
277
|
|
|
280
278
|
```sh
|
|
281
279
|
export SP_DC_COOKIE="your_sp_dc_cookie_value"
|
|
280
|
+
export REFRESH_TOKEN="your_spotify_app_refresh_token"
|
|
282
281
|
export SMTP_PASSWORD="your_smtp_password"
|
|
283
282
|
```
|
|
284
283
|
|
|
@@ -288,6 +287,7 @@ Alternatively store them persistently in a dotenv file (recommended):
|
|
|
288
287
|
|
|
289
288
|
```ini
|
|
290
289
|
SP_DC_COOKIE="your_sp_dc_cookie_value"
|
|
290
|
+
REFRESH_TOKEN="your_spotify_app_refresh_token"
|
|
291
291
|
SMTP_PASSWORD="your_smtp_password"
|
|
292
292
|
```
|
|
293
293
|
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
spotify_monitor.py,sha256=OGM62kDeXOa8SO0RZK1Lhuagbw_Ltchy_oWtWW3xkIA,152513
|
|
2
|
+
spotify_monitor-2.2.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
3
|
+
spotify_monitor-2.2.dist-info/METADATA,sha256=yXfwE_3vT7INKsIWxyBX9EgC2i3SL7-chl9gFNmH1lY,22382
|
|
4
|
+
spotify_monitor-2.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
5
|
+
spotify_monitor-2.2.dist-info/entry_points.txt,sha256=8HzePfUcCSXrYaXOwLbNNYO8GJcnhgCSl4wcDNECht8,57
|
|
6
|
+
spotify_monitor-2.2.dist-info/top_level.txt,sha256=EP6IPD4vHT12rLM5b_jo2i3nrfOuwk3ehhr2gWdQx9Y,16
|
|
7
|
+
spotify_monitor-2.2.dist-info/RECORD,,
|