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.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: spotify_monitor
3
- Version: 2.1.1
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
- #### Spotify access token source
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
- The **recommended method** is `cookie` which uses the sp_dc cookie to retrieve a token from the Spotify web endpoint.
166
+ **Recommended: `cookie`**
170
167
 
171
- The **alternative method** is `client` which uses captured credentials from the Spotify desktop client and a Protobuf-based login flow. This approach is intended for advanced users who want an indefinitely valid token with the widest scope.
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
- If no method is specified, the tool defaults to the `cookie` method.
170
+ **Alternative: `client`**
174
171
 
175
- <a id="spotify-sp_dc-cookie"></a>
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
- It is default method used to obtain a Spotify access token.
174
+ If no method is specified, the tool defaults to the `cookie` method.
179
175
 
180
- Log in to [https://open.spotify.com/](https://open.spotify.com/) in your web browser.
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
- Locate and copy the value of the `sp_dc` cookie.
178
+ <a id="spotify-sp_dc-cookie"></a>
179
+ #### Spotify sp_dc Cookie
183
180
 
184
- Use your web browser's dev console or **Cookie-Editor** by cgagnier to extract it easily: [https://cookie-editor.com/](https://cookie-editor.com/)
181
+ This is the default method used to obtain a Spotify access token.
185
182
 
186
- Provide the `SP_DC_COOKIE` secret using one of the following methods:
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
- Fallback:
192
- - Hard-code it in the code or config file
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
- You will be informed by the tool once the `sp_dc` cookie expires (proper message on the console and in email).
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 you store the `SP_DC_COOKIE` in a dotenv file you can update its value and send a `SIGHUP` signal to the process 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).
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
- **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.
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
- To use credentials captured from the Spotify desktop client to obtain an access token, set the `TOKEN_SOURCE` configuration option to `client` or use the `--token-source client` flag.
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
- Launch the Spotify desktop client and look for POST requests to `https://login{n}.spotify.com/v3/login`
203
+ - Run an intercepting proxy of your choice (like [Proxyman](https://proxyman.com)).
208
204
 
209
- Note: The `login` part is suffixed with one or more digits (e.g. `login5`).
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
- Then run the tool with `-w <path-to-login-request-body-file>`:
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
- You can also persist the Protobuf request file path using the `LOGIN_REQUEST_BODY_FILE` configuration option.
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
- Advanced options are available for further customization - refer to the configuration file comments. However, default settings should work for most cases.
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
- You will be informed by the tool once the refresh token expires (proper message on the console and in email).
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
- **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.
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,,