0

I am trying to paginate the track list of a set/playlist obtained via soundcloud JSON API. Pagination technique described here works fine if I want to generate tracklist of x number of tracks for next page only. What I am trying to do is to make a numbered pagination with multiple page links. I didn't find any parameter such as "track_count" which returns the total number of tracks for "/user/tracks". So, can anyone give me any insights on making a numbered pagination for a playlist when getting data via soundcloud JSON API? thanks

Zihad
  • 352
  • 3
  • 21

2 Answers2

0

/users endpoint has "track_count" property in the returned representation of user:

$ curl "http://api.soundcloud.com/users/3207.json?client_id=YOUR_CLIENT_ID"

{
  "id": 3207,
  "permalink": "jwagener",
  "username": "Johannes Wagener",
  "uri": "http://api.soundcloud.com/users/3207",
  "permalink_url": "http://soundcloud.com/jwagener",
  "avatar_url": "http://i1.sndcdn.com/avatars-000001552142-pbw8yd-large.jpg?142a848",
  "country": "Germany",
  "full_name": "Johannes Wagener",
  "city": "Berlin",
  "description": "<b>Hacker at SoundCloud</b>\r\n\r\nSome of my recent Hacks:\r\n\r\nsoundiverse.com \r\nbrowse recordings with the FiRe app by artwork\r\n\r\ntopbillin.com \r\nfind people to follow on SoundCloud\r\n\r\nchatter.fm \r\nget your account hooked up with a voicebox\r\n\r\nrecbutton.com \r\nrecord straight to your soundcloud account",
  "discogs_name": null,
  "myspace_name": null,
  "website": "http://johannes.wagener.cc",
  "website_title": "johannes.wagener.cc",
  "online": true,
  "track_count": 12,
  "playlist_count": 1,
  "followers_count": 417,
  "followings_count": 174,
  "public_favorites_count": 26
}
Misha Reyzlin
  • 13,736
  • 4
  • 54
  • 63
  • This is the total number of tracks a specific user has uploaded. But my concern is to get track_count for a specific playlist created by that user – Zihad Sep 05 '13 at 12:11
  • Sorry for misunderstanding, you have `track_count` property on playlist objects as well – Misha Reyzlin Sep 05 '13 at 12:34
  • Its not there in playlist object. See here: http://developers.soundcloud.com/docs/api/reference#playlists – Zihad Sep 05 '13 at 12:52
  • 1
    Unfortunately it seems like the docs aren't udpated, the property's there in the response – try to do a request – http://api.soundcloud.com/playlists/405726.json?client_id=YOUR_CLIENT_ID – Misha Reyzlin Sep 05 '13 at 12:53
  • yes! I was deceived by the docs and didn't even check the response at the first place. Thanks for the info. Sadly, I am trying to get track_count for a private playlist and track_count returns zero as there is no public track in that specific playlist. thanks anyway! learnt a new thing ! :) – Zihad Sep 05 '13 at 13:10
  • I've updated the documentation to include the `"track_count"` attribute. Sorry for the confusion. – sferik Sep 18 '13 at 16:30
0

This question is already old, but I hope this could help other people.

You could use either of this endpoint:

The 2nd API is undocumented, the first endpoint suddenly started to return 401 for no reason which is from the SoundCloud API documentation. I still provided the 1st endpoint as it's only not working at work, but behaves correctly at home IP address. I suggest if you'd use the 2nd API to generate and use a non-expiring token.

SoundCloud is not a reliable provider anymore as there's no app support for developers. You just have to figure things out by yourself.

On the JSON response, look for track_count. That'll give you the number of tracks in a playlist.

Sampaguita
  • 96
  • 1
  • 4