Spotify API - Can I find the Completion % of a song? - spotify

I am working with some clients who want to be able to see the average completion percentage their tracks are listened to on Spotify (e.g. 50% is half the song).
The API documentation doesnt show how this can be done, but i have seen some label platforms offering this data (AWAL etc)
Am I missing anything obvious?
API Document Link: https://developer.spotify.com/documentation/
Thanks in advance!
I've looked through the documentation and no obvious field for completion time

As for many APIs there seems to be a separate one for Analytics https://analytics.spotify.com/faq/api#api
It also looks like you need to be a label/author registered with Spotify https://analytics.spotify.com/c/api/

Related

Instagram Graph API - media_product_type not showing STORY

I currently have the below API response for one of our instagram pages using the Graph API that includes media_product_type, even though our Page has a STORY we are not seeing it come through, but we do see FEED and IGTV, see here for the documentation on this field. Has this happened to anyone else?
/12334555/media?limit=100&period=lifetime&fields=name%2Ccaption%2Clink%2Cshortcode%2Ccomments_count%2Cmedia_type%2Cpermalink%2Clike_count%2Ctimestamp%2media_product_type&access_token='blah'
You will need to use the stories endpoint (not media)
eg:
{baseUrl}/{version}/{instagramUserId}/stories?fields=caption,media_url,timestamp,permalink,username,media_type,like_count,comments_count,shortcode,thumbnail_url,video_title,media_product_type&limit=10&access_token={accessToken}
Note: story info is only around for 24 hours, so ideally you polls for infor and then setup the webhook to receive the final counts before the story dissapears.

Google Analytics measurement protocol not in report only in real-time

I've got a chrome extension with a call to Google Measurement Protocol to register 'event's in Google analytics. Events are registered in real-time but do not appear in reports (also checked several days afterwards). I've tried something similar with 'pageview'.
What could be the reasons for failure ? I've checked similar questions on SO with no clear solution. Checking with the Hit Builder does not provide any clue.
Typical parameters are :
v=1&t=event&tid=UA-xyxyxyxy-1&uid=be653208-154c-4924-88dd-66695804217f&dh=https%3A%2F%2Fmysite.net%2F&dp=%2Fsgc&dt=Qwe%20Abc%20Dfg%20&ec=%2Favcdef&ea=abcddfgfdgfdgfdgfdgfdgfd
Thanks for any help ...
I tried your call and it seems to work properly. Considering that you don't send the cid but the uid you can see the event in the User-ID view.

How to grab instagram users based on a hashtag?

is there a way to grab instagram users based on a specific hashtag ?
I run contests based on re posting photos with specified hashtag then randomly pick a winner, i need a tool that can grab the usernames of those who reposted that photo and used that hashtag.
You can query instagram using the API. There are official clients for both python and ruby.
You didn't specify what language/platform you are using, so I'll give you the generic approach.
Query instagram using the Tag Recent Media endpoint.
In the response, you will receive a user object that has the user's username, id, profile url, and so on. This should be enough to do what you are describing.
As far as tools, there aren't great options to probably do things exactly how you want. If you just want a simple contest, you could use statigram, but it's not free.
If you roll your own solution, I highly recommend you also do the following:
Implement a rate limiting mechanism such as a task queue so you don't exceed your API calls (5000 per hour for most calls). Also useful for failures/network hicups, etc.
Have users authenticate so you can use OAuth to extend your API calls to 5000/per user/hour to get around #1.
Try the subscribe API if there won't be many items. You can subscribe to a specific tag as well, and you will get a change notification. At that point though you need to retrieve the actual media item(s), and this can cost a lot of API calls depending on how frequent and what volume these changes occur.
If your users don't have much photos/relatively small/known in advance, you can actually query the user's recent media instead and filter in your own code by hash tag.

How to lookup Spotify User metadata (playlists, currently playing, etc)

I only see Artist, Album, and Tracks lookups in the docs. I want to display what I'm currently listening to. Is there a way to do this using the API?
https://developer.spotify.com/technologies/web-api/lookup/
Spotify does not provide this at this time. You can either get it by turning on last.fm scrobbling or accessing facebook music data.
As Thomas said Spotify does not provide such a feature 'directly'.
But there are some ways to get it work.
You have to me some more sprcific what you want to do. Web/Desktop/App
I wrote a tiny console app using an external dll
"File/Link removed" - send pm for further information!
If this is what you need just message me. It's a rly tiny application just for test purposes! Because I currently develop a overlay.

Territory restrictions and linked tracks in Spotify

I am building an app that needs to know if a track is playable in the user's region.
It's easy to check the basic territorial restrictions of a track using the Metadata API. However, I am encountering tracks that the Metadata API says are out of my region, but are auto-linked to versions of the same track that aren't region locked. ie. Metadata says I can't play a track, but as far as the user is concerned, Spotify can play that track.
Here's an example:
'Sweet Unrest' by Apparat # spotify:track:4H4h3ulzjGVox14GHiCEoo
I am in the UK (territory code GB)
The lookup link is http://ws.spotify.com/lookup/1/.json?uri=spotify:track:4H4h3ulzjGVox14GHiCEoo
There is no GB code in the resulting territories string, so in theory, I should not be able to play the track. However, in the main Spotify player, I can see that it is auto linked to spotify:track:11S6TQybYumAnNApugZWSJ which is playable in my region. If I paste the supposedly unplayable track's URI into the top left Spotify search box, it plays.
Is there an API based way to check for tracks like this?
You can detect whether a track is playable or not using an undocumented property of each track: data.availableForPlayback
Track.fromURI("spotify:track:XXX", function(track) {
alert(track.data.availableForPlayback);
});
If you run the code above, you should get a True/False that does what you're after.
Unfortunately not, not at this time. The linking is actually done by the client itself rather than any of our backend services, so none of our APIs have this information.

Resources