spotify-monitor 2.1.2__py3-none-any.whl → 2.2.1__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.2.dist-info → spotify_monitor-2.2.1.dist-info}/METADATA +42 -36
- spotify_monitor-2.2.1.dist-info/RECORD +7 -0
- spotify_monitor.py +378 -207
- spotify_monitor-2.1.2.dist-info/RECORD +0 -7
- {spotify_monitor-2.1.2.dist-info → spotify_monitor-2.2.1.dist-info}/WHEEL +0 -0
- {spotify_monitor-2.1.2.dist-info → spotify_monitor-2.2.1.dist-info}/entry_points.txt +0 -0
- {spotify_monitor-2.1.2.dist-info → spotify_monitor-2.2.1.dist-info}/licenses/LICENSE +0 -0
- {spotify_monitor-2.1.2.dist-info → spotify_monitor-2.2.1.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.1
|
|
3
|
+
Version: 2.2.1
|
|
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
|
|
@@ -25,7 +25,7 @@ Dynamic: license-file
|
|
|
25
25
|
|
|
26
26
|
# spotify_monitor
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
Tool for real-time monitoring of Spotify friends' music activity feed.
|
|
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
|
|
|
@@ -40,6 +40,7 @@ NOTE: If you're interested in tracking changes to Spotify users' profiles includ
|
|
|
40
40
|
- Saving all listened songs with timestamps to the CSV file
|
|
41
41
|
- Clickable Spotify, Apple Music, YouTube Music and Genius Lyrics search URLs printed in the console & included in email notifications
|
|
42
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`)
|
|
43
44
|
- Possibility to control the running copy of the script via signals
|
|
44
45
|
|
|
45
46
|
<p align="center">
|
|
@@ -156,65 +157,66 @@ spotify_monitor --generate-config > spotify_monitor.conf
|
|
|
156
157
|
Edit the `spotify_monitor.conf` file and change any desired configuration options (detailed comments are provided for each).
|
|
157
158
|
|
|
158
159
|
<a id="spotify-access-token-source"></a>
|
|
159
|
-
|
|
160
|
+
### Spotify access token source
|
|
160
161
|
|
|
161
162
|
The tool supports two methods for obtaining a Spotify access token.
|
|
162
163
|
|
|
163
164
|
It can be configured via the `TOKEN_SOURCE` configuration option or the `--token-source` flag.
|
|
164
165
|
|
|
165
|
-
|
|
166
|
+
**Recommended: `cookie`**
|
|
166
167
|
|
|
167
|
-
|
|
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.
|
|
168
169
|
|
|
169
|
-
|
|
170
|
+
**Alternative: `client`**
|
|
170
171
|
|
|
171
|
-
|
|
172
|
-
#### 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.
|
|
173
173
|
|
|
174
|
-
|
|
174
|
+
If no method is specified, the tool defaults to the `cookie` method.
|
|
175
175
|
|
|
176
|
-
|
|
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.
|
|
177
177
|
|
|
178
|
-
|
|
178
|
+
<a id="spotify-sp_dc-cookie"></a>
|
|
179
|
+
#### Spotify sp_dc Cookie
|
|
179
180
|
|
|
180
|
-
|
|
181
|
+
This is the default method used to obtain a Spotify access token.
|
|
181
182
|
|
|
182
|
-
|
|
183
|
-
- Pass it at runtime with `-u` / `--spotify-dc-cookie`
|
|
184
|
-
- Set it as an [environment variable](#storing-secrets) (e.g. `export SP_DC_COOKIE=...`)
|
|
185
|
-
- 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.
|
|
186
184
|
|
|
187
|
-
|
|
188
|
-
|
|
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/)
|
|
189
187
|
|
|
190
|
-
|
|
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
|
|
191
193
|
|
|
192
|
-
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.
|
|
193
195
|
|
|
194
|
-
|
|
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).
|
|
195
197
|
|
|
196
198
|
<a id="spotify-desktop-client"></a>
|
|
197
199
|
#### Spotify Desktop Client
|
|
198
200
|
|
|
199
|
-
|
|
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.
|
|
200
202
|
|
|
201
|
-
|
|
203
|
+
**NOTE**: Spotify appears to have changed something in client versions released after June 2025 (likely a switch to HTTP/3 and/or certificate pinning). You may need to use an older version of the Spotify desktop client for this method to work.
|
|
202
204
|
|
|
203
|
-
|
|
205
|
+
- Run an intercepting proxy of your choice (like [Proxyman](https://proxyman.com)).
|
|
204
206
|
|
|
205
|
-
|
|
207
|
+
- Launch the Spotify desktop client and look for POST requests to `https://login{n}.spotify.com/v3/login`
|
|
208
|
+
- Note: The `login` part is suffixed with one or more digits (e.g. `login5`).
|
|
206
209
|
|
|
207
|
-
If you don't see this request, log out from the client and log back in.
|
|
210
|
+
- If you don't see this request, log out from the Spotify desktop client and log back in.
|
|
208
211
|
|
|
209
|
-
Export the login request body (a binary Protobuf payload) to a file.
|
|
210
|
-
|
|
211
|
-
In Proxyman: ***right click the request → Export → Request Body → Save File***.
|
|
212
|
+
- Export the login request body (a binary Protobuf payload) to a file (e.g. ***login-request-body-file***)
|
|
213
|
+
- In Proxyman: **right click the request → Export → Request Body → Save File**.
|
|
212
214
|
|
|
213
215
|
<p align="center">
|
|
214
216
|
<img src="https://raw.githubusercontent.com/misiektoja/spotify_monitor/refs/heads/main/assets/proxyman_export_protobuf.png" alt="proxyman_export_protobuf" width="80%"/>
|
|
215
217
|
</p>
|
|
216
218
|
|
|
217
|
-
|
|
219
|
+
- Run the tool with `--token-source client -w <path-to-login-request-body-file>`:
|
|
218
220
|
|
|
219
221
|
```sh
|
|
220
222
|
spotify_monitor --token-source client -w <path-to-login-request-body-file> <spotify_user_uri_id>
|
|
@@ -222,15 +224,17 @@ spotify_monitor --token-source client -w <path-to-login-request-body-file> <spot
|
|
|
222
224
|
|
|
223
225
|
If successful, the tool will automatically extract the necessary fields and begin monitoring.
|
|
224
226
|
|
|
225
|
-
|
|
227
|
+
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.
|
|
228
|
+
|
|
229
|
+
The same applies to `--token-source client` flag - you can persist it via `TOKEN_SOURCE` configuration option set to `client`.
|
|
226
230
|
|
|
227
231
|
The tool will automatically refresh both the access token and client token using the intercepted refresh token.
|
|
228
232
|
|
|
229
|
-
|
|
233
|
+
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.
|
|
230
234
|
|
|
231
|
-
|
|
235
|
+
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).
|
|
232
236
|
|
|
233
|
-
|
|
237
|
+
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.
|
|
234
238
|
|
|
235
239
|
<a id="following-the-monitored-user"></a>
|
|
236
240
|
### Following the Monitored User
|
|
@@ -269,12 +273,13 @@ spotify_monitor --send-test-email
|
|
|
269
273
|
<a id="storing-secrets"></a>
|
|
270
274
|
### Storing Secrets
|
|
271
275
|
|
|
272
|
-
It is recommended to store secrets like `SP_DC_COOKIE` or `SMTP_PASSWORD` as either an environment variable or in a dotenv file.
|
|
276
|
+
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.
|
|
273
277
|
|
|
274
|
-
Set environment variables using `export` on **Linux/Unix/macOS/WSL** systems:
|
|
278
|
+
Set the needed environment variables using `export` on **Linux/Unix/macOS/WSL** systems:
|
|
275
279
|
|
|
276
280
|
```sh
|
|
277
281
|
export SP_DC_COOKIE="your_sp_dc_cookie_value"
|
|
282
|
+
export REFRESH_TOKEN="your_spotify_app_refresh_token"
|
|
278
283
|
export SMTP_PASSWORD="your_smtp_password"
|
|
279
284
|
```
|
|
280
285
|
|
|
@@ -284,6 +289,7 @@ Alternatively store them persistently in a dotenv file (recommended):
|
|
|
284
289
|
|
|
285
290
|
```ini
|
|
286
291
|
SP_DC_COOKIE="your_sp_dc_cookie_value"
|
|
292
|
+
REFRESH_TOKEN="your_spotify_app_refresh_token"
|
|
287
293
|
SMTP_PASSWORD="your_smtp_password"
|
|
288
294
|
```
|
|
289
295
|
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
spotify_monitor.py,sha256=-uJet8WI668Ihnqs3uArowPfrYa4MUzB1QPYEL_1EGg,153671
|
|
2
|
+
spotify_monitor-2.2.1.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
3
|
+
spotify_monitor-2.2.1.dist-info/METADATA,sha256=q0IT4d33nTghRZ4boNvp0KxUgmD17-URY6bQMTgPAI8,22613
|
|
4
|
+
spotify_monitor-2.2.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
5
|
+
spotify_monitor-2.2.1.dist-info/entry_points.txt,sha256=8HzePfUcCSXrYaXOwLbNNYO8GJcnhgCSl4wcDNECht8,57
|
|
6
|
+
spotify_monitor-2.2.1.dist-info/top_level.txt,sha256=EP6IPD4vHT12rLM5b_jo2i3nrfOuwk3ehhr2gWdQx9Y,16
|
|
7
|
+
spotify_monitor-2.2.1.dist-info/RECORD,,
|