Skip to content

Prodigy90/spotify-data-ip_addr-cleaner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spotify Data Cleaner

A Go utility to clean Spotify streaming history JSON files by removing IP address information and combining multiple files into a single cleaned dataset.

Features

  • 🧹 Remove IP addresses from Spotify streaming data for privacy
  • 📁 Process multiple files at once from a list
  • 🔄 Combine all data into a single output file
  • Fast processing with proper error handling
  • 📊 Progress tracking with detailed output

Installation

  1. Make sure you have Go installed (version 1.16+)
  2. Clone or download this repository
  3. Build the program:
    go build -o spotify-cleaner main.go

Usage

Basic Usage

  1. Create a text file with your JSON filenames (one per line):

    echo "Streaming_History_Audio_2024_1.json" > filelist.txt
    echo "Streaming_History_Audio_2024_2.json" >> filelist.txt
    echo "Streaming_History_Audio_2024_3.json" >> filelist.txt
  2. Run the cleaner:

    ./spotify-cleaner < filelist.txt

Alternative Methods

Using echo:

echo -e "file1.json\nfile2.json\nfile3.json" | ./spotify-cleaner

Using here document:

./spotify-cleaner << EOF
Streaming_History_Audio_2024_1.json
Streaming_History_Audio_2024_2.json
Streaming_History_Audio_2024_3.json
EOF

Direct compilation and run:

echo -e "file1.json\nfile2.json" | go run main.go

Input Format

The program expects:

  • Input: Text file with JSON filenames (one per line) via stdin
  • JSON Files: Spotify streaming history files in JSON array format

Example input file (filelist.txt):

Streaming_History_Audio_2020-2021_0.json
Streaming_History_Audio_2021-2022_1.json
Streaming_History_Audio_2022-2023_2.json

Output

  • File: spotify_cleaned_[timestamp].json
  • Format: Single JSON array containing all cleaned records
  • Removed: ip_addr field from all records
  • Preserved: All other fields (track name, artist, timestamp, etc.)

Example

Input JSON structure:

[
  {
    "ts": "2024-01-01T12:00:00Z",
    "username": "user123",
    "platform": "Android OS",
    "ms_played": 240000,
    "conn_country": "US",
    "ip_addr": "192.168.1.1",
    "master_metadata_track_name": "Song Title",
    "master_metadata_album_artist_name": "Artist Name"
  }
]

Output JSON structure:

[
  {
    "ts": "2024-01-01T12:00:00Z",
    "username": "user123", 
    "platform": "Android OS",
    "ms_played": 240000,
    "conn_country": "US",
    "master_metadata_track_name": "Song Title",
    "master_metadata_album_artist_name": "Artist Name"
  }
]

Error Handling

The program handles:

  • ✅ Missing files (skips and continues)
  • ✅ Invalid JSON format (skips and continues)
  • ✅ Empty input (exits with error)
  • ✅ File permission issues
  • ✅ Malformed filenames

Privacy Note

This tool is designed to help protect your privacy by removing IP address information from Spotify data exports while preserving all music listening history and metadata.

Requirements

  • Go 1.16 or higher
  • Read access to JSON files
  • Write access to current directory

Troubleshooting

"No filenames provided"

  • Make sure your input file contains filenames
  • Check that you're using < or | to pipe input

"Error reading file"

  • Verify file paths are correct
  • Check file permissions
  • Ensure files exist in the current directory

"Error parsing JSON"

  • Verify files are valid JSON format
  • Check for corrupted downloads from Spotify

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages