Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

soundcloud API - JSON track count does not match profile track count

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

like image 678
samnicho Avatar asked Apr 14 '16 14:04

samnicho


1 Answers

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.

like image 144
Dark Swordsman Avatar answered Nov 17 '22 06:11

Dark Swordsman