In the Soundcloud API, is information about a track still available after it's removed due to DMCA infringement? - soundcloud

I'm building an app that utilizes Soundcloud API and we came across a small problem. We archive playlists on our own servers to cut down on the amount of data needed to display tracks. So, for example, a user can create a playlist with tracks from soundcloud but we strip away the data provided by soundcloud to the minimum required to view and play said track. This data includes it's SC_ID, track name, artist, stream URL, etc. But doesn't provide the full data set SC does.
My question:
When songs are removed due to DMCA Copyright infringement, does SoundCloud keep the track ID and information available or does it remove the track entirely? What I mean by this is, say I have a track with ID 123456 and it was removed due to DMCA. Does this track still exist such that I could GET request [SC_api_url]/tracks/123456.json which would yield the track but it would not be streamable nor downloadable?
Correct my logic if I am wrong. I've searched the documentation and the best answer I can get is if you try and request a resource that is not available it throws a common 404 error but the API is not very clear on what happens when tracks are removed due to DMCA violations.

So I reached out to Soundcloud and they said that they are removed from the public facing API.
This means an error would occur if you referenced it.
This is also true for exceeding quotas.
Hope this also helps someone else too!

Related

How to get live video id from YouTube channel

YouTube API eventType=live not working, does anyone have an idea why?
https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=UCmyKnNRH0wH-r8I-ceP-dsg&eventType=live&type=video&key=
Without eventType was working fine (but not now):
https://www.youtube.com/embed/live_stream?channel=UCmyKnNRH0wH-r8I-ceP-dsg&autoplay=1
Looks like YouTube changed something in API, search.list really not returning live broadcast since end of last week.
If you have user's access token you can use https://www.googleapis.com/youtube/v3/liveBroadcasts?part=snippet&broadcastStatus=active&broadcastType=all
endpoint to retrieve if any broadcast is live.
If you do not have user's access token, you can try this answer
but i didn't check it if it is working
Anyway this question looks like to be a duplicate of this question
Right now the YouTube API is not working, specifically for retrieving live streams of a specific channelId. In other words if you are setting channelId in the API call, you will get 0 results.
If you're using an API key rather than OAuth (not sure if OAuth works) the only work around at the moment is to use the API to search for a specific title. Here is my query URL below.
https://www.googleapis.com/youtube/v3/search?part=id%2Csnippet&type=video&maxResults=20&order=date&q=My+Uniquely+Titled+Livestream&key=[apiKey]
The results returned by the API will be from all of YouTube. (Note: the rest is done serverside) Put the results into an array and discard any that don't match your channelId. Then check the titles in an array and only get the video ID of the one that matches your desired title. That is the basic logic and it is sort of a rigid work around that won't work for most. But at least it will get you what you need until Google fixes the API.

What should be the Rest URL for the action "Move the competitor from team1 to to team2"

I am looking for a good URL, following REST principes, to "Move the competitor from team1 to to team2
My first guess is :
/teams/{oldTeamId}/{newTeamId}/competitors/{competitorId}/move
But it doesn't look much like REST.
Should I break it into 2 basics calls ?
Remove competitor from team1,
Add competitor to team2,
Should I remove some data from URL and pass it into the body ?
I don't really know what to do for this one.
Think about how you would implement this API as a web site.
You would probably have a link to a form -- it might be a form where the competitor, old team, and new team are all blank, or it might be a form where the competitor and old team are pre-populated. Your consumer updates the default information in the form as required, and submits it.
Notice the first point (raised by Roman Vottner as well) -- your consumer doesn't need to look at the URL at all. The client knows the HTML form processing rules, so it can create the correct HTTP request without knowing anything about the domain.
The second point is that, since the client is just submitting the form to wherever the HTML tells it to, you can make that anything you want.
One of the interesting properties of HTTP is cache invalidation. See RFC 7234, any non error response to an unsafe request will invalidate all cached representations of one resource.
So you can choose which resource gets invalidated by specifying its URI as the target of the form. In effect, it gives you a mechanism for ensuring that a consumer can read its own writes.
So some reasonable choices for the target might be
/teams/{oldTeamId}
if the team roster is the most important thing. Or
/competitors/{competitorId}
if the resource that describes the player is what is most important.
I don't really know what to do for this one.
Concentrate on make it easy to use. Your resource model is not your domain model is not your data model.
It will likely be useful to watch Jim Webber's talk REST: DDD In the Large to get clearer insights into what your "REST" API should really look like.
To answer your questions, I would not break it into two calls, I would however take some data from that (GET) url and put it in the body of your request. The request would probably be a POST or PUT (or maybe even patch), but definitely not a GET since something is actually changing.
As for a solution, how about a POST request to a /transfer. After all you are (could be) creating a new transfer which takes for example the player, their new team and maybe their old team.
I would use URL to identify the resource which in this case seems to be a competitor's team.
So would
Make the url as /competitors/{competitorId}/teams
Make the call PUT
Have a body with newTeamId and if required the oldTeamId.

Missing 'available_countries' information on some track API requests

Some of the API requests to get track details are missing the array of available_countries in which the track can be played.
For instance this Pink Floyd track:
http://api.deezer.com/track/89569653
But when testing in the API console the available_countries are present for this track ID.
It only seems to happen for some tracks though, for instance the Daft Punk API example does have the available_countries data:
http://api.deezer.com/track/3135556
Is it an issue with the API?
The node "available_countries" is there but empty, so it just means that the track is not available in any country, it is not an issue. If you check directly in our website www.deezer.com/track/89569653, you will see that the track is not available.

Order by playbacks when fetching tracks from SoundCloud

I am fetching a list of tracks from soundcloud's API using the following query to retrieve the 5 most popular tracks:
https://api.soundcloud.com/tracks?client_id=XXX&order=hotness&limit=5
But recently SoundCloud removed the hotness order. In the blog post they say tracks can instead be sorted by playback_count. But can this be done in the query or do they suggest I pull down the whole SoundCloud library and order them in the client? The following doesn't seem to work:
https://api.soundcloud.com/tracks?client_id=XXX&order=playback_count&limit=5
So how would one retrieve the top tracks on SoundCloud?
The solution was to use the undocumented calls for the explorer feature that SoundCloud itself uses (I used the dev tools in Chrome to check the AJAX calls).
https://api.soundcloud.com/explore/sounds/category?limit=L&client_id=XXX
This appears to use some sort of sorting on the popularity of the songs. The songs can then be filtered on only music by checking the "grouping" attribute. I then have to resolve the list of IDs to actual songs which can be done with the (documented, official) API call:
https://api.soundcloud.com/tracks?ids=1,2,3&client_id=XXX
This seems to work perfectly and I also get the added benefit of an even distribution among genres. But of course, this can stop working at any moment since the API calls are undocumented and perhaps not meant for public use.
Just wanted to provide an update. It seems soundcloud has moved to v2 of the explore API call.
Use this to get a list of categories:
https://api.soundcloud.com/explore/v2
And this to get tracks from a category:
https://api-v2.soundcloud.com/explore/metal?limit=10&offset=0
So far it seems to without a key, although I have no idea how long that will last.
EDIT: So the 2nd url doesn't seem to allow cross-origin, but so far this does work, though it only returns the trackID not the full information
https://api.soundcloud.com/explore/v2/metal?limit=50&consumer_key=XXX
check here, soundcloud removed order by hotness.
Has order by hotness been removed from Soundclouds API
so, for now, only order by date is possible.

Real Time Update not working for some fields?

I'm checking wich fields from the User object are susceptible to RTU (real time updates); in the documentation it says:
The User object supports Real-Time Updates for all fields except the
verified property.
But, so far, for this fields:
video upload limits television significant other favorite_teams
favorite_athletes political interested_in bio updated_time
third_party_id gender user_likes languages
I've got this message:
{"error":{"message":"(#100) \"SOME_FIELD\" is an invalid field name","type":"OAuthException"}}
My application has the necessary permissions, checked by using this method (taken from this url):
https://api.facebook.com/method/users.hasAppPermission?ext_perm=SOME_PERMISSION&uid=UID&access_token=ACCESS_TOKEN_FOR_MY_APP
Am I missing something? Those fields are working for someone else or is just me?
Thanks.
I've tried the same. Facebook seems to be a little slow here. They did not implement all fields in the RTU. You can find a list of available fields here (under objects): https://developers.facebook.com/docs/reference/api/realtime/
However, even this list does not seem correct, as I did not get for example television to work either.
It is kind of odd to ask for the object "user" to get notifications about you page.. This all does not seem to be finished yet..