13

I'm building a web app using the soundcloud JavaScript SDK that should only return profiles that contain one or more tracks.

My GET request returns an array of user profiles, each including the track_count property and associated value, as expected.

However, when I follow the link to each profile, the number of tracks is often different from the value listed in the JSON (see example in images below). Crucially, in relation to my purpose, this means that it sometimes returns profiles with 0 tracks.

From my tests so far, I've found that if the values are different then the profile track count is always less than in the JSON. Could this mean that's it's including tracks that have been deleted or removed (e.g. because of copyright infringement)?

I would really appreciate if someone could shed some light on this.

Thanks!

$(document).ready(function() {
          SC.initialize({
            client_id: 'xxxx',
            redirect_uri: 'http://localhost/callback.html'
          });

          SC.get('/users/12490371/followers', {

            limit: page_size,
            linked_partitioning: 1

          }).then(function(followers) {

            $(followers.collection).each(function(i) {
              //console.log(followers.collection[i].track_count)

              if (followers.collection[i].track_count > 10 && followers.collection[i].followers_count < 500) {
                $("#list").append(
                  "<ul>" +
                  "<li class='username'>" + this.username + "</li>" +
                  "<li>" + this.followers_count + "</li>" +
                  "<li>" + this.track_count + "</li>" +
                  "<li><a href='" + this.permalink_url + "' target='_blank'>GO</a>" + "</li>" +
                  "</ul>"
                );
              }

            });
          });
        });
<div id="list">
  <ul>
    <li class='username'>Username</li>
    <li>Followers</li>
    <li>Track count</li>
    <li>Profile</li>
  </ul>
</div>

profile view JSON view

samnicho
  • 141
  • 1
  • 10
  • 3
    Yep -- there's many reasons that a track might not show up to you. It could be taken down by the rightsholder of the track, made private or deleted by the uploader, or (and this is the tricky one) blocked in certain territories. Calculating the policies of all of the tracks of a user every time it is fetched isn't quite feasible, so sometimes this number will be inaccurate (depending on who is asking and where they are). – nickf Apr 14 '16 at 22:37
  • Thanks Nick, that makes sense. Appreciate you getting back to me.You say it's 'not quite feasible', does this mean that it might be feasible in a future update? – samnicho Apr 15 '16 at 14:53
  • No. Sorry, I should have been clearer with that. – nickf Apr 18 '16 at 14:29
  • 2
    @nickf is it possible to at least show basic information about the track using the API, since I see quite some questions about empty results / 403's being returned even though the track count is > 0. Lots of people are questioning about this recently and from the documentation this is not clear. See for example: http://stackoverflow.com/questions/36360202/soundcloud-api-urls-timing-out-and-then-returning-error-403-on-about-50-of-trac/36529330#36529330 – DelGurth Apr 18 '16 at 17:14
  • 1
    There's not so much we can do about that -- the tracks do not belong to us, and if the rightsholder doesn't want their tracks accessed in this way, we should honour that. Your application will need to be resilient to fetching a page and getting less results than requested. – nickf Apr 19 '16 at 08:59
  • 4
    @nickf - This is a major issue, SoundCloud devs. Take a popular artist -- Seven Lions (soundcloud.com/seven-lions). Querying for tracks turns up zero items (users/659761/tracks) which is a terrible user experience for our forthcoming app. Worse, querying for that artist's playlists works, yet querying for tracks in each playlist again returns zero items (e.g. playlists/148145188). Please start discussions over there that this issue is destroying the 3rd party API experience, guys! Others in agreement, vote up if you agree! – Drew O'Meara Apr 21 '16 at 16:15
  • 3
    @nickf - are the SC users aware of the implications of this choice? Can you help us understand why it's in their interests to do this? I can only see that it's in SC's interests since the only way to hear those tracks is the SC app or soundcloud.com. – Drew O'Meara Apr 21 '16 at 16:28
  • @nickf: I agree that if the owner doesn't want it you can't do anything about it. But does the owner want the entire track hidden, or just prevent playback via other apps? Currently 3rd party developers are not able to see information about which tracks are in a playlist, if the tracks on it are blocked. A better UX could be that you can see what is in the playlist, but not being able to play it in the 3rd party app. – DelGurth May 02 '16 at 10:33
  • In some cases, it's definitely to make it entirely hidden. Some tracks are uploaded prior to a marketing promo release, for example, and they would not want even the existence of these tracks to leak. – nickf May 03 '16 at 12:15
  • 1
    @nickf: can't agree more. But in that case they would not want it to be counted in the playlist track count either, do they? Since that is also a way to leak information about an upcoming release. – DelGurth May 03 '16 at 15:35
  • 4
    @nickf We learned that as soon as an account gets managed by a major publisher i.e. Universal, all of the user's tracks are blocked from the API. Any new track that gets uploaded will have these rights revoked as well. Basic public information of a public SoundCloud track should be available on the API. Right now there's not even any distinguishing behind a connectivity issue or a track being blocked. – Dxx Aug 21 '16 at 22:25
  • 2
    @nickf this functionality just seems straight up broken. A great way to actively discourage people from building for your platform – Matt Bucci Sep 29 '16 at 21:18
  • This is about some external API functionality description best answered/researched there rather than a coding question perhaps. – Mark Schultheiss Sep 05 '19 at 14:55
  • I'm voting to close this question as off-topic because this is about an external API functionality rather than coding. – Mark Schultheiss Sep 05 '19 at 14:56

1 Answers1

1

To answer your question, it definitely seems that the SoundCloud API returns all tracks from the artist, no matter what state those tracks are in (public, private, etc.).

As far as the rest goes, Sound Cloud is notorious for being strict with how artists' content is handled in terms of embedding or having it used on other sites. It is usually up to the artist from my understanding, but in general, they want artists' content to be protected, especially if they are under a contract with a record company or something.

As for your web app, you'll either have to work around it or just ditch it completely, unless you can create some sort of scraper that can get more relevant info. If your site wants to play music directly from the site, however, you may be at a loss.

Stephen Rauch
  • 47,830
  • 31
  • 106
  • 135