Create top lists using Spotify Web Api - spotify

Anyone have a good ide how I can create music top lists using Spotify or echonest Web API?
For example create a top 25 list of music from the 80's of the genre rock in Sweden. Or the most streamed tracks on the global market of genre pop for the year 2010.

Using the Search endpoint, you can retrieve tracks by genre within some year interval. It also accepts a market parameter, but the order is not guaranteed to be by popularity though.
https://api.spotify.com/v1/search?type=track&q=genre:pop+year:1980-2020&market=SE
This is probably as close as you can get using the Web API as it is today.
There are playlists that are updated with the most popular tracks in most (if not all) markets, although not by genre. For Sweden's Top 50, see http://open.spotify.com/user/spotify/playlist/7jmQBEvJyGHPqKEl5UcEe9.

Related

What is mediaItemId in Google Photos API?

I am reading the Google Photos API documentation. I can't find out what mediaItemId is, see for example here:
https://developers.google.com/photos/library/guides/access-media-items#get-media-item
There are some other questions that might be related, but they have no answers:
How to get mediaItemId of a Google photo using its shared URL?
I've not used the API but I'm familiar with other Google services and am a Photos user.
If you consider you're experience with photos.google.com, you browse a somewhat unstructured list of all your photos. The Photos (phone|browser) apps do categorize photos by date but you have to search to filter by other metadata to find the specific photo(s) that you're seeking. Or you happy-scroll through years of photos of your cat.
This contrasts with another common metaphor for arranging files in which a hierarchy of folders is used to categorize the content e.g. /photos/cats/2022 but this mechanism is limited because you can only really navigate through one dimension (the folders).
Considerable metadata (type, width|height, creation date etc.) is associated with each photo and it is customary in schemas like this to construct a unique ID for each object. The unique ID is sometimes exposed to the end-user but not necessarily. Identifiers are generally for the system's own purposes.
With Photos, there are public, unique identifiers in the form of URLs for each photos but evidently the id and the URL although probably related (perhaps via a hash) aren't obviously related.
So, since it's not always possible to specific a photo uniquely by e.g. "The one of my dog where he's wearing sunglasses because of the eclipse" and the absence of folders, a really powerful alternative (which you'll need to employ) is to search for some subset of the photos and then iterate over the results.
It appears that the Photos service has such a search to which you provide Filters and each of the items in the results will be a MediaItem (uniquely identified by id).
Unlike the file system example above, because Photos does not use a fixed hierarchy, we can view our Photos by filtering them using an extensive set of metadata: photos of cats, taken in 2022, using my phone.

Getting total number of streams and track release date through Spotify API

I'm trying to get a large list of songs released in year X, together with their number of plays/streams.
I've been using Spotify API, and I have a number of highly popular songs. Now, for my purposes, I also need a list of non-popular songs (low play counts). I am wondering if there is any strategy to get a list of songs (maybe last played ones?), and extract their release year and number of total plays?
I've been going through the API documentation and I can only find 'popularity', which seems different from total number of plays. Secondly, I haven't found a way to get a list of last played songs yet. Should I be considering another type of strategy?
I know that you can get a list of recently played songs of all users in certain user groups in last.fm. Perhaps there is something similar in Spotify API?
Unfortunately, there is no way to get play counts through the Spotify API, only the Popularity metric.

Is there a way to get Mel-frequency cepstrum coefficients of a track from the Spotify API?

I am looking to get the MFCC(Mel-frequency cepstrum coefficients) of a spotify track. My main aim is to identify genre of a track, and the algorithm which I'm studying right now uses MFCC to extract features of a track.
I think there might be 2 ways to do this:
Spotify's API has an endpoint called https://api.spotify.com/v1/audio-analysis/{id}. This is what the output looks like for a track. Maybe there is a way to get MFCC from this output?
Get raw audio features of the track from an API endpoint and then use a (different) library to apply MFCC on the features.
Or, is there any other method I can try?
Thanks :)
Edit :
The output of audio-analysis API for a track given here contains a key called "tmfccrack". Is this related to the MFCC?
I found out that you can get the genre of a Spotify track by getting the genre of the corresponding artist through the Spotify API. That gets me what I want for now, but I think I should keep the question open because it asks for the MFCC of a track and not just the genre.

How to Look Up Spotify IDs (Song / Track IDs) in Bulk?

I have a list of songs - is there a way (using the Spotify / Echo Nest API) to look up the Spotify ID for each track in bulk?
If it helps, I am planning on running these IDs through the "Get Audio Features" part of their API.
Thanks in advance!
You can use the Spotify Web API to retrieve song IDS. First, you'll need to register to use the API. Then, you will need to perform searches, like in the example linked here.
The Spotify API search will be most useful for you if you can provide specifics on albums and artists. The search API allows you to insert multiple query strings. Here is an example (Despacito by Justin Bieber:
https://api.spotify.com/v1/search?q=track:"' + despacito + '"%20artist:"' + bieber + '"&type=track
You can paste that into your browser and scan the response if you'd like. Ultimately you are interested in the song id, which you can find in the uri:
spotify:track:6rPO02ozF3bM7NnOV4h6s2
Whichever programming language you choose should allow you to loop through these calls to get the song IDs you want. Good luck!
It has been a few years, and I am curious how far you got with this project. I was doing the same thing around 2016 as well. I am just picking up the project again, and noticing you still cannot do large bulk ID queries by Artist,Title.
For now I am just handling HttpStatusCode 429 and sleeping the thread as I loop through a library. It's kind of slow but, I mean it gets the job done. After I get them I do the AudioFeatures query for 100 tracks at a time so it goes pretty quickly that way.
So far, this is the slowest part and I really wish there was a better way to do it, or even a way to make your own 'Audio Features' based on your library It just takes a lot of computing cycles. However ... one possible outcome might be to only do it for tracks that you cannot find on Spotify ;s

Is it possible to get the most popular artist per city with the Spotify API?

I am wondering if it is possible to get the most popular artist of my city with the Spotify API.
The current API (2016-05) doesn't seem to provide location specific queries. Artists of a city would be found in the Search for an Item-API-reference but there's no such a dedicated possibility.
You could search for keywords mentioning your city or for tags including your city (tag:Berlin) but you'd certainly not obtain all artists of that city with this type of query.
But say you had all artists of a particular city, you'd still have to measure how successful these artists actually are.
A rather easy metric would be to collect an artist's top tracks and evaluate the popularity integer value of these tracks. These values can be compared to other artists (e.g. for a first trial by average popularity).

Resources