alberto56
alberto56

Reputation: 3172

Use soundcloud embed to create embed code from the command line for private sounds

I understand that it's possible to use oembed to get embed code for private files, but I'm running into "403 forbidden" when I try it.

http://soundcloud.com/albert-albala-1/audio-recording-on-monday/s-VzgUg

is accessible in a browser, but

curl -iL http://soundcloud.com/oembed?url=http%3A//soundcloud.com/albert-albala-1/audio-recording-on-monday/s-VzgUg&format=json&auto_play=false

yields a HTTP/1.1 403 Forbidden error. The same call with a public sound works fine:

curl -iL http://soundcloud.com/oembed?url=http%3A//soundcloud.com/osmconcerts/rosemarie-landryv2&format=json&auto_play=false

Related question: Rendering SoundCloud widget for a private track using PHP API, although that one uses PHP. I'm trying to get this to work on the command line.

Upvotes: 1

Views: 1085

Answers (2)

Dave Nattriss
Dave Nattriss

Reputation: 41

Just had this problem myself, and the track/sound settings have changed layout/structure since pje's answer from 30/09/2013.

Currently, under Permissions, you need to make sure that 'Display Embed code' is turned on - despite the fact that you may not want this to happen! Doing so should mean a 200 status code is returned along with the embed metadata.

Essentially what this is doing is allowing the track to be publicly embedded on other sites (despite the track being private in terms of not being listed on the main account page).

Upvotes: 0

pje
pje

Reputation: 22697

It's possible to embed private tracks using a secret token if the track's settings allow embedding.

Embedding is allowed by default, but if you're receiving a 403 with a valid secret token, you've probably disallowed public embedding for the track.

You can enable this through the web UI on your track's edit page under Settings -> Advanced -> Widget Settings -> Click to enable -> For everybody:

Widget disabled — click to enable

Upvotes: 4

Related Questions