I usually listen to music on Spotify and sometimes I want to sort it in order of the number of views, but the number of views itself cannot be seen in the app.
Instead, Spotify's PC version site (https://www.spotify.com/jp/) You can download viewing history etc. as JSON format data.
So, I downloaded my data, counted it in Python, and displayed it.
** Download procedure ** Click the button from Profile> Privacy Settings> Download Your Data. You will receive a download link by email. It will take up to 30 days, so be patient.
I only use the standard library, so even if you don't know programming, you can use it by copying and executing it as long as you have Python on your PC.
I wrote it for myself, so I'm sorry if it doesn't work.
count.py
import json
import collections
#Read json data
# file_For path, specify your StreamingHistory file.
with open('file_path') as f:
d = json.load(f)
list = []
print("Do you want to search the whole thing? y/n")
search_all = str(input())
print("How many times do you want to display it?")
count = int(input())
#Extraction of song title&Add to list
#In case of whole search
if search_all == "y":
for i in d:
list.append(i['trackName'])
#In case of specified search
elif search_all == "n":
print("Please enter the artist")
artist = str(input())
for i in d:
if(i['artistName'] == artist):
list.append(i['trackName'])
#Get elements in order of appearance
c = collections.Counter(list)
c_list = c.most_common()
print("------------")
print("Song title,Views")
#Display the number of views above a certain level
for i in c_list:
if i[1] >= count:
print(i)
Python is convenient because you can do various things quickly.
Recommended Posts