How to get thumbnail of SoundCloud using API?

前端 未结 5 493
情话喂你
情话喂你 2021-02-06 03:16

For example:

http://soundcloud.com/mhiqu3/sets/heretik/

How to get the thumbnail url: http://i1.sndcdn.com/artworks-000004897289-5r6ws9-large.jpg?1767646

5条回答
  •  日久生厌
    2021-02-06 03:38

    what you want to do is use Soundclouds API like so:

    SC.get(PATH, function (track, err){
      IMG_URL = track.artwork;
    });
    

    you can see an example here: http://runnable.com/UuiMCfATvMMkAAAS/get-a-tracks-artwork-on-soundcloud-in-javascript#

    the PATH to the track can be obtained in different ways
    1. if you know the image id you can grab it like so
    var PATH = "/tracks" + id;
    2. if you know the name and user of the track
    var PATH = "/users/dj-faze/tracks/phase-shift-360-019-degrees"
    3. you can also get the id with other soundcloud API's

    NOTE: Ensure the track's image you are trying to get is public. If it is private your going to have to log in with soundcloud authorization API.

提交回复
热议问题