How To Get All Songs of An Artist on Spoitfy? - rest

In their docs for getting top tracks on an artist they mention this:
The 10 maximum tracks are the ones displayed by the Spotify app. If you want to fetch more artist’s top tracks, an alternative way is to use Echo Nest song/search to accomplish this. It will accept a Spotify artist id for input and give you Spotify id’s in the output.
I'm pretty sure the Echo Nest Api no longer exists, so I am wondering if there is still a way to get songs of an artist other than just 10 of them?
Alternatively I was thinking of using Last.fm's Api to do it if Spotify no longer supports that functionality, if anyone has any other suggestions of how one could work around this that would be great! Thanks in advance.

I think you won't be able to achieve it in single API call in Spotify. However there's an alternative:
Request all albums of an artist (have a look here):
https://api.spotify.com/v1/artists/{id}/albums
And then request the tracks of each album (have a look here):
https://api.spotify.com/v1/albums/{id}/tracks
To avoid one request for each album, you can get multiple albums at once and when an album is requested, the tracks of such album will be returned in a paging object. You can pass the desired albums identifiers separated by , in the id query parameter to the following endpoint (have a look here):
https://api.spotify.com/v1/albums

A solution that was more sufficient for me here was:
https://api.spotify.com/v1/search?type=track&q=artist:ArtistName
this returns the top songs by this artist, with pagination so definitely more than 10 results.
The only caveat is that this includes songs that the artist might be featured on, but I think this is useful really as if it's a popular song your user might be looking for it.

Related

Deezer API : get user's favorite genres

I'm using the deezer API and I wonder if there is a way to find user's favorite genre ?
The only solution I found is to search for every user's favorite album (https://api.deezer.com/album/105374). But this requires a lots of request !
I wonder if it's possible to get several album details in one time ? (e.g. https://api.deezer.com/album/105374,1053743). Or maybe something else ?
Thank you !
Unfortunately, there is no way to get that information directly. What you can do is to get the top tracks/albums with http://developers.deezer.com/api/user/charts, and look for the genre.
There is no possibility too to get several albums in the same request.

Finding the album of a song

I've been playing around with Echonest, but can't seem to figure out how to get the album of a song (given I have the artist name and the song). I'd also like to find the genre and the album cover. Or are these things I'd have to use foreign ID spaces for (Rosetta Stone)?
Honestly, it'd be nice if I could punch in the artist name and title and get a summary of information about the song.
check out this:
http://developer.echonest.com/docs/v4/song.html#search
you should provide your title and artist name to the search api possibly with an external id like id:7digital or id:spotify since echonest does not give you album information directly. I guess most of the cases you can find foreign release id for spotify album and get the release information about it from spotify. Instead, you can skip echonest api and directly make your searches in spotify API.

Final Checklist/Written Approval for Facebook Graph Use

i am using this endpoint
https://api.facebook.com/method/links.getStats?urls=
to collect the number of likes of specific urls. I want to display this information on a front end but do not want to make unnecessary API calls (there are over 25,000 posts). I would like to retrieve this information and store it so it can be retrieved from our database. On some pages, there will be over 10 of these accessible view a hover effect from a mouse. I would prefer to not have to load the page up with javascript targeted elements everywhere. It would be much easier to have the information stored and updated periodically. We will not be going over the impression limit or even coming close, but I would like to just make sure I'm not doing anything that will get me in trouble.
I would like permission to utilize this data to help increase pathways between our site and Facebook to allow people to share the page. I'm pretty sure we're doing everything correct but would just like to make sure and not step on anyone's toes.
I read through the checklist here
https://developers.facebook.com/docs/opengraph/submission-process/
however I don't know if what I'm doing would be considered an app....? Any advice would be appreciated.
Have a look at my answer here: How do I get the likes number from facebook for a given url?
You can also use FQL queries with IN lists to query multiple URLs at once. Please consider that a FQL statement can have a maximum length of 2048 characters.
select url, like_count from link_stat where url in ('URL1', 'URL2', ...)
The "cheklist" you linked is completely unneccessary, because you don't need to submit anything related to OpenGraph objects or actions. You can even use the functionality without using an Access Token, because the link_stat table is public (https://developers.facebook.com/docs/reference/fql/link_stat/)

"Top Posts" depending on facebook likes

I have an idea to create a "top posts" feature to my website, which creates the "top" list depending on how many likes and shares that a post have on facebook.
Users may see how many likes an post has received so far since they only have to ask for a single, defined url. However, the website itself has to be able to query all the links that are tied to itself (which have a predefined url template like website.com/[post-id]) to create the "top" list. Is it possible to do something similar (or achieve the same result in a different way)?
Any ideas on a real workflow about something like this will be appreciated!
this seems like a little but interesting project. I don't know if there is a feature that could get that directly in the way you want, but i did something similar.
First you have the Graph API, with that you can get the Posts of a user using feed, with that every post is telling you how many likes does it have which you can get with POST_ID/likes.
Then you'll have to check for changes in the post periodically comparing its created_time and updated_time.
This could seem very hard, because you have a lot of posts and you have to check them all for updates, but you can use batch_requests so you can check them all at once.
I have made a bookmarklet which shows top posts in the Facebook News Feed as well as Google+, Twitter and Instagram Profiles.
Just add a new bookmark in your bookmarks bar and replace its URL with the following code and save it, then go to the social network website and run it:
javascript:(function(){var s=document.createElement('script');s.src='https://niutech.github.io/topnewsfeed/topnewsfeed.min.js';document.body.appendChild(s);})()
The source code is available on GitHub.

good way to let users search their friends on my fb app

I want to let my users search(not browse) their friend on my fb app. What is the best way?
I have surveyed this issue for hours. I got two ways:
use Graph API:
https://graph.facebook.com/me/friends?access_token=...
by this way, I can get the friends of user as json, and by parsing the json, I can get the one who is the user's target.
However, there are two issues.
First, user need to input the exact name of his/her friend. For example, my app can't find "Steve Jobs" with "Steve" by parsing json.
Second, if the user has a lot of friends, the cost of parsing json may be terrible.
2.
use the searching api:
https://graph.facebook.com/search?q=mark&type=user
by this way, user can get "Steve Jobs" with "steve". However, it is obvious that users may find someone who is not their friend.
I think neither of these ways are ideal enough. Any suggestion?
Thank you sincerely!
How about this: Request dialogs
https://developers.facebook.com/docs/reference/dialogs/requests/
--
For Search Partially, may use indexOf function to check whether this string is match