阅读背景:

soundcloud API - JSON跟踪计数不匹配概要跟踪计数。

来源:互联网 

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

我正在使用soundcloud JavaScript SDK构建一个web应用程序,它应该只返回包含一个或多个跟踪的概要文件。

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

我的GET请求返回一个用户配置文件数组,每个用户配置文件都包括track_count属性和相关值。

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.

但是,当我跟踪到每个配置文件的链接时,跟踪的数量通常与JSON中列出的值不同(参见下面的图片中的示例)。至关重要的是,与我的目的相关,这意味着它有时返回带有0个跟踪的配置文件。

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)?

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

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

如果有人能给我一些启示,我会非常感激。

Thanks!

谢谢!

$(document).ready(function() {
          SC.initialize({
            client_id: 'xxxx',
            redirect_uri: 'https://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='/go.html?url=" + 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

概要视图JSON视图

1 个解决方案

#1


0  

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.).

要回答你的问题,SoundCloud API显然会返回来自艺术家的所有歌曲,无论这些歌曲处于什么状态(公共、私有等)。

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.

至于你的web应用程序,你要么得绕过它,要么干脆彻底抛弃它,除非你能创建某种能获得更多相关信息的刮刀。然而,如果你的网站想要直接从网站播放音乐,你可能会不知所措。


分享到: