Skip to content

Instantly share code, notes, and snippets.

@MiranDaniel
Last active June 6, 2022 14:13
Show Gist options
  • Save MiranDaniel/a35ff62701bf3e231f50ceae132d8332 to your computer and use it in GitHub Desktop.
Save MiranDaniel/a35ff62701bf3e231f50ceae132d8332 to your computer and use it in GitHub Desktop.
Get Spotify total play time
import json
count = 10 # change this to the total count of endsong files
files = [f"endsong_{i}.json" for i in range(count+1)]
mstotal = 0
total = 0
for i in files:
data = json.load(open(i))
for j in data:
mstotal += j["ms_played"]
total += 1
print(f"{mstotal=}")
print(f"{total=}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment