soundcloud API - JSON轨道计数与配置文件跟踪计数不匹配

sam*_*cho 11 javascript json soundcloud

我正在使用soundcloud JavaScript SDK构建一个Web应用程序,该SDK应该只返回包含一个或多个轨道的配置文件.

我的GET请求返回一组用户配置文件,每个配置文件都包含track_count属性和关联值,如预期的那样.

但是,当我按照每个配置文件的链接时,轨道数通常不同于JSON中列出的值(请参见下图中的示例).至关重要的是,就我的目的而言,这意味着它有时会返回包含0个曲目的配置文件.

从我到目前为止的测试中,我发现如果值不同,那么配置文件跟踪计数总是小于JSON.这是否意味着它包括已被删除或删除的曲目(例如,因为版权侵权)?

如果有人能够对此有所了解,我将非常感激.

谢谢!

$(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>"
                );
              }

            });
          });
        });
Run Code Online (Sandbox Code Playgroud)
<div id="list">
  <ul>
    <li class='username'>Username</li>
    <li>Followers</li>
    <li>Track count</li>
    <li>Profile</li>
  </ul>
</div>
Run Code Online (Sandbox Code Playgroud)

配置文件视图 JSON视图

Dar*_*man 1

为了回答你的问题,SoundCloud API 似乎确实会返回艺术家的所有曲目,无论这些曲目处于什么状态(公共、私人等)。

就其他方面而言,Sound Cloud 因对艺术家内容的嵌入或在其他网站上使用的处理方式严格而臭名昭著。根据我的理解,这通常取决于艺术家,但总的来说,他们希望艺术家的内容受到保护,特别是如果他们与唱片公司或其他公司签订了合同。

至于您的网络应用程序,您要么必须解决它,要么完全放弃它,除非您可以创建某种可以获取更多相关信息的抓取工具。然而,如果您的网站想要直接从该网站播放音乐,您可能会不知所措。