spotify-secrets/README.md
2025-10-11 23:21:52 +02:00

103 lines
2.6 KiB
Markdown

# spotify-secrets
A Spotify secrets scraper that updates hourly to monitor and extract secrets from Spotify's infrastructure.
Original method by [misiektoja/spotify_monitor](https://github.com/misiektoja/spotify_monitor/blob/dev/debug/spotify_monitor_secret_grabber.py), simplified for use without a full browser environment.
## Installation
To install dependencies:
```bash
deno install
```
## Usage
To run:
```bash
deno run run
```
## Using the JSON Data
The scraper generates three JSON files that are updated hourly and exposed via raw JSON URLs:
### Plain Secrets (array)
**URL**: `https://code.thetadev.de/ThetaDev/spotify-secrets/raw/branch/main/secrets/secrets.json`
Returns a JSON array of following objects: `{ "version": number, "secret": string }`
```json
[ { "version": 12, "secret": "secret12" }, { "version": 13, "secret": "secret13" } ]
```
### Secret Bytes (array)
**URL**: `https://code.thetadev.de/ThetaDev/spotify-secrets/raw/branch/main/secrets/secretBytes.json`
Returns a JSON array of following objects: `{ "version": number, "secret": number[] }`
```json
[ { "version": 12, "secret": [115, 101, 99, 114, 101, 116, 49, 50] }, { "version": 13, "secret": [115, 101, 99, 114, 101, 116, 49, 51] } ]
```
### Secret Bytes (object/dict)
**URL**: `https://code.thetadev.de/ThetaDev/spotify-secrets/raw/branch/main/secrets/secretDict.json`
Returns a JSON object mapping each version to its array of byte values: `{ [version: string]: number[] }`
```json
{ "12": [115, 101, 99, 114, 101, 116, 49, 50], "13": [115, 101, 99, 114, 101, 116, 49, 51] }
```
### TypeScript Interface
The scraper outputs secrets in one of two unified formats:
**Array format** (`secrets.json`, `secretBytes.json`):
```typescript
interface SpotifySecrets {
secret: string | number[];
version: number;
}[];
```
**Object/Dict format** (`secretDict.json`):
```typescript
interface SpotifySecretsDict {
[version: string]: number[]
}
```
### Usage Example (TypeScript)
```typescript
// Fetch secrets
const response = await fetch('https://code.thetadev.de/ThetaDev/spotify-secrets/raw/branch/main/secrets/secrets.json');
const secrets: SpotifySecrets = await response.json();
// Get latest version
const latestSecret = secrets[secrets.length - 1];
console.log(`Version ${latestSecret.version}: ${latestSecret.secret}`);
```
### Usage Example (Python)
```python
import requests
# Fetch secrets
response = requests.get("https://code.thetadev.de/ThetaDev/spotify-secrets/raw/branch/main/secrets/secretDict.json")
secrets = response.json()
# Get latest version
latest_secret = secrets[(v := max(secrets, key=int))]
print(f"Version {v}: {latest_secret}")
```