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

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).

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.

Similar venues with location foursquare API

I am playing with Foursquare API and I was wondering if theres an endpoint for getting a similar venue in a location given another venue?
All I found is this endpoint:
https://api.foursquare.com/v2/venues/VENUE_ID/similar
Which returns a list of venues similar to a given venue. What I want is, exactly this but I want the returned venues be close to a given location.
For example:
I love a mexican restaurant in London.
I want to find a similar restaurant but in Barcelona.
Is that possible?
Thanks!
The venues/similar endpoint will only show similar venues near the desired venue. Your best bet is probably using the query parameter with venues/explore. The query parameter is pretty smart about determining your intent if you know what you're looking for and you can specify any location.
i.e.
https://api.foursquare.com/v2/venues/explore?
query=Mexican food outdoor seating
near=Barcelona

Get list of venues of whole city

How I can receive all venues in city (for example, in Moscow).
I am trying to get list of all venues via https://api.foursquare.com/v2/venues/explore?near=Moscow,Russia&radius=20000&limit=50&&offset=0&client_id=clid&client_secret=clsecret&v=20160307
http requsts by changing offset parameter, but totalCount of venues in result list is 249 (for Moscow it is small).
So, is it possible to get list of all venues for so huge city as Moscow?
It is neccesary for my bachelor work, I write a reccomendation system for building tourist routes and only foursquare service have a extensive database with cafes, museums and monuments.
Thanks

Create top lists using Spotify Web Api

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.

Foursquare API: Search venues in whole city

Is it possible to search venues (via venues/search) in whole city without passing "radius" parameter? Because I don't know radius of each city :) Documentation says "Searches can be done near a point or through a whole city", but how can I provide this in venues/search?
Thanks.
I do not think there is a way to tell it 'search the entire city', but I also think it might be a wrong use case.
You need to remember a few things when searching:
Foursquare will return up to 50 results (the limit parameter)
The 50 results are ordered by the most popular places around the center of your search
So if you are searching a city which have more than 50 venues in Foursquare database, 'searching the entire city' will usually get the same (up to) 50 results - always.
This where the filters comes in handy, in our case, to get you better results for our needs, we use the categoryId combined with the radius to get things we want to show our users. Sometimes we get information from other cities because of a big radius, but for our application its okay, we actually give our customers more options :) . I can also guess that a lot of apps also use the query filter as they know the name of the place they are looking for.
You just need to experiment with it and discover how to get the data which is right to your application.
In theory, to search an entire city I would use the city lat/lng from Google or Open Street Maps or geonames and do a 10Km search around that point (intent=browse, radius=10000), the following is a guess, but it will get 50 places for over 99% of the cities people who own smartphones live in :)
You can do obtain results within in a city as follows:
https://api.foursquare.com/v2/venues/search?near=Singapore,Singapore&client_id=YOUR_CLIENT_ID
&client_secret=YOUR_CLIENT_SECRET3&v=YYYYMMDD
For more details check the documentation:
https://developer.foursquare.com/docs/venues/explore
Assuming you're talking about requests with a query, I would just set a reasonable value for radius and use the city's default city center. If you want to avoid showing results from neighboring cities, you can post-request filter by the returned venue's "city" string in the location stanza.

Resources