I'm developing a simple app using Python where I can post tracks to my own Soundcloud account. I would like to get the 'Secret link' URL for a track that I post. For example, I get the most recent track like so:
track = client.get('/me/tracks', limit=1)[0]
The track is set to private. It suggests in the Docs that something like this should return the secret token:
client.get('/tracks/%d/secret-token' %track.id)
However, I get HTTPError: 404 Client Error: Not Found. All the other subresources seem to work. This example code, for example, works as you would expect:
comments = client.get('/tracks/%d/comments' %track.id)
for comment in comments:
print comment.body
I would have thought that, given that I have authenticated using my credentials, I would have access to this. Is this correct? Any assistance would be greatly appreciated.
The /me/tracks endpoint returns a Track
object that includes secret_token
as well as the full uri secret_uri
.
track = client.get('/me/tracks', limit=1)[0]
print "Secret Token: %s" %track.secret_token
print "Track URI: %s" %track.secret_uri
I found I needed to include the client_id
in the URI to avoid getting a 401.
Note: this is undocumented so check with their support team before relying this in an application
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With