Soundcloud API playlist returns no tracks in certain cases - api

When trying to get the track details for a playlist using the /playlists endpoint, for certain playlists there are no tracks returned in the data.
Sample of returned data
"license":"all-rights-reserved",
"tracks":[],
"playlist_type":null,
"id":199987807,
So far all the playlists behaving this way contain a single track, but NOT all playlists with one track return no tracks.
Examples of no tracks returned:
http://api.soundcloud.com/playlists/199987807?client_id=YOUR_CLIENT_ID
http://api.soundcloud.com/playlists/199987052?client_id=YOUR_CLIENT_ID

SoundCloud API keys have different access levels. SoundCloud can restrict API access for certain artists and playlists based on the API key used to make the request.
As you can see, a standard developer API key cannot see the tracks from those playlists.
There is a way around this, although it breaks SoundCloud's terms of service.
Using a different API key, such as the key youtube-dl uses to get the MP3 link for specific tracks (which is presumably a Soundcloud master key), gives you access to this information.
Again, using someone else's API key violates SoundCloud's terms of service, and there is no guarantee this key will continue working. This is just a workaround to the current restriction you're seeing.
Related discussion in two other questions: Get HTTP MP3 stream from every song and SoundCloud API returning 0 tracks despite user having tracks.

Related

Loading all YouTube video metadata to an application database

Google YouTube API allows maximum 10,000 units of quota per day. I am trying to avoid 'Quota Exceeded' error as I am making too many calls against the "Search: list" API which costs 100 units of quota per API call.
I read this and several other blogs; and went with my own below analysis.
I am planning to pull data every day once and store it in the database. Can any expert please confirm if below will cover up all the videos under the channel, or I will miss some?
(1) Playlists: list --> Get all the playlists from the channel.
(2) PlaylistItems: list --> Iterate over each playlist one by one, and get all videos in it.
To answer your comment #Test:
I want to ask whether if i loop all playlists, will it give ma all the videos under channel id or not.
If by all playlists you mean all playlists intentionally created by the given YouTube channel then it depends whether or not he selected all his videos.
I would recommend you to use this approach to retrieve all YouTube videos of a given YouTube channel which seems to be your case. The approach consists in getting the uploads auto-created playlist id of the YouTube channel by using Channels: list with contentDetails in part and then use PlaylistItems: list to retrieve all public videos uploaded on this YouTube channel. Using this method you will retrieve all public YouTube videos as long as the studied YouTube channel has less than 20 000 YouTube public videos. In this last case use this script which softwarly fake an automatic browse in the Videos tab of the given YouTube channel.

Soundcloud API returns empty

Thanks in advance for the help.
So while developing an application, I need API data and I retrieve JSON objects. Not a big deal, but with one certain account it doesn't work.
https://api.soundcloud.com/tracks/257255126?client_id=CLIENT_ID_HERE
The ID 257255126 is a track from this profile: https://soundcloud.com/discoverysounds1/.
Every track from this profile returns empty from the API while the same API link works if I insert a track ID from any other profile.
I've already notified the owner of the problem and he hasn't done anything weird or disabled API access if that's even possible.
What could be the problem here?
Thanks,
Jordan
I just tested this with a website I am developing using the API.
If I add one of the tracks to an existing playlist that I have created to test certain functionality, the track does not appear in the playist when retrieved via the /me/playlists endpoint.
When I load the playlist into the soundcloud widget, the track is visible and unrestricted (as in full duration and not a 30 second preview).
I am seeing similar behaviour with tracks that are marked as "soundcloud go" not being visible in the playlist tracks from the /me/playlists endpoint, but available via the widget when the playlist is loaded (albeit only a 30 second preview in their case).
Those items are identifiable as having a "SUB_HIGH_TIER" monetization_model
The track I loaded from your example
There seem to be various issues with the API right now related to the implementation of "soundcloud go"

Searching on geolocation in the SoundCloud API?

The SoundCloud API allows you to search. Coordinates (lat/lng) seem to be stored as tags in the tag_list property for tracks. It seems I can filter on matching tags.
Can I use the SoundCloud API to find matching tracks with a geospatial bounding box or a centre with a radius?
Or can I only match coordinates exactly?
If the former, how?
The SoundCloud blog posts talking about mapping audio links to maps that don't open. For example:
http://maps.soundcloudlabs.com/?lat=32.47269502206151&lon=13.359375&maxOffset=50&zoom=3
Furthermore, I'm unable to add geotags to my files on SoundCloud. Adding them as tags and saving the file fails silently: Upon reopening the file for editing, the geotags do not show up.
Third, SoundCloud API calls for tracks do not seem to include geotags.
Fourth, searching for a geotag using the SoundCloud API consistently returns no results.
Therefore, it is safe to assume that SoundCloud no longer supports geocoding on their audio files.

Can I use the Spotify recommendation intelligence in an app?

On the Spotify dashboard an user has a great experience through the recommended artist and songs. I would like to use this intelligence in an app we plan to develop for a big Dutch based podium. So the app can give a list of concerts playing at the poppodium which the user might be interested in.
Can I get this recommended artist data, based on the user's history, through the Spotify API?
The Spotify API now provides recommendations:
https://developer.spotify.com/web-api/get-recommendations/
Recommendations are generated based on the available information for a
given seed entity and matched against similar artists and tracks. If
there is sufficient information about the provided seeds, a list of
tracks will be returned together with pool size details.
For artists and tracks that are very new or obscure there might not be
enough data to generate a list of tracks.
There are a bunch of parameters that can be configured for fine-tuning the recommendation: key, genre, loudness, energy, instrumentalness, popularity, speechiness, danceability, key ...
You can use Spotify's Web API endpoints to fetch these data:
The Get a User’s Top Artists and Tracks endpoint will give you artists and tracks based on user's listening history. You can also use the Get Current User’s Recently Played Tracks, which will give you up to 50 recently played tracks.
Use the artists and tracks you just get and use them as seeds for the Get Recommendations Based on Seeds endpoint. This endpoint will only return tracks. If you want to get artists based on other artists there is the Get an Artist’s Related Artists endpoint that you can use.
As you see, combining multiple endpoints will get you covered. Just make sure you read the Web API Authorization Guide before. You are going to need the user to authenticate in order to get user's data.
Note: When the question was first posted (July 2013), Spotify's Web API didn't exist. The question referred to a now defunct Spotify Apps API which didn't provide a way to generate recommendations based on listening history.

Find the playlists a video is in via Youtube API

I want to know which playlists contain a certain video. The opposite is easy: find which video's are in a playlist, but I don't want that.
I can already have YT do this via the following route, but that's stupid and slow:
get channelId from video data (videos?id=...)
get playlists from channelId (playlists?channelId=...)
loop through all playlists and find all their videos (playlistItems?playlistId=...)
Like I said: stupid and slow. These steps are possible, because I only want playlists authored by the video's author. (Otherwise I'd have to download all of YT.)
What I'm looking for, sort of, is a request: playlists?videoId=..., but of course that doesn't exist.
Is there a better way than my 3 steps?
PS. I've created the script to use my 3 steps, but it's A LOT of requests. That and the playlists don't seem to have usable playlist ID's... I need the ID that the browser uses to show the playlist GUI style.
As of now, the Youtube API does not support a call like this, and in my opinion never will. This is probably an intentional decision by Youtube to hide the playlists, even the YT Analytics API doesn't show how many lists use your video.
It seems the way you do it is the only workaround - in case you only need the playlists for one specific user.