0

我的 permalink_url 示例是“ https://soundcloud.com/rac/sets/rac-chapter-one ”。我需要一个函数来从永久链接 url 生成 artifact_url 变量。类似于从 Soundcloud 文档中提取的这段代码,但表示为一个函数:

<script src="http://connect.soundcloud.com/sdk.js"></script>
SC.initialize({
  client_id: 'YOUR_CLIENT_ID'
});

// permalink to a track
var track_url = 'https://soundcloud.com/rac/sets/rac-chapter-one';

SC.get('/resolve', { url: track_url }, function(track) {
  SC.get('/tracks/' + track.id + '/comments', function(comments) {
    for (var i = 0; i < comments.length; i++) {
      console.log('Someone said: ' + comments[i].body);
    }
  });
});
</script> 

对于这种类型的编码,我是一个勉强能干的玩家,如果有任何实际帮助,我将不胜感激。干杯!

4

1 回答 1

0

您拥有artwork_url声音表示的属性:

<script src="http://connect.soundcloud.com/sdk.js"></script>
SC.initialize({
  client_id: 'YOUR_CLIENT_ID'
});

// permalink to a track
var track_url = 'https://soundcloud.com/rac/sets/rac-chapter-one';

SC.get('/resolve', { url: track_url }, function(track) {
  console.log(track.artwork_url);
});
</script> 
于 2013-04-27T13:07:15.827 回答