Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tracks on private playlist (with secret_token) generating 404 error on stream #74

Open
alexweinstein opened this issue Dec 9, 2016 · 3 comments

Comments

@alexweinstein
Copy link

alexweinstein commented Dec 9, 2016

Streaming a private track from a private playlist used to work fine as long as you used the playlist's secret token. It now generates a 404. This started happening yesterday (Dec. 7, 2016).

SC.initialize({
    client_id: xxxxxxxxxxxxxxxx,
    redirect_uri: xxxxxxxxxxxxxxxx
});
SC.stream('/tracks/[trackid], [playlist_secret_token]).then(function(data) {
    data.play();
}).catch(function(error) {
    alert('Error! ' + error.message);
});

The error:
Failed to load resource: the server responded with a status of 404 (Not Found)

What's interesting is that this generates an error:

https://api.soundcloud.com/tracks/[trackid]?secret_token=[playlist_secret_token]&format=json&client_id=xxxxxxxxxxxxxx

While this resolves correctly:

https://api.soundcloud.com/tracks/[trackid]/stream?secret_token=[playlist_secret_token]&format=json&client_id=xxxxxxxxxxxxxx

Is anyone else having this problem? Did anything change in regards to playlist secret tokens?

@alexweinstein alexweinstein changed the title Tracks on private playlists (with secret_token) generating 404 error on stream Tracks on private playlist (with secret_token) generating 404 error on stream Dec 9, 2016
@diurnalist
Copy link
Contributor

Hi @alexweinstein, I presume you have some sort of access to the track's secret token if you have the playlist's secret token (I think the secret_token field is returned for those private tracks.) If you have access to that, I would simply use the track's secret token for any request involving that track. The fact that playlist secret tokens can work for private tracks is a bit of a holdover from older "rules" of the product and might not necessarily work in the future, but requesting a secret track with its secret_token should continue to be supported. Does that help?

@alexweinstein
Copy link
Author

alexweinstein commented Dec 9, 2016

@diurnalist That does help. Thank you for jumping on this.

I should add one more thing. Tell me if this affects your response at all.

When calling a private playlist with it's secret_token the tracks returned have that same secret_token in their stream_url.

For example:
https://api.soundcloud.com/playlists/280621215?secret_token=s-6AMBa&format=json&client_id=xxxxxxxxxxx

Return of one track from that playlist (note the stream_url and uri have that same secret_token from the playlist):
"kind": "track", "id": 296005616, "created_at": "2016/12/03 12:18:13 +0000", "user_id": 101050993, "duration": 34145, "commentable": true, "state": "finished", "original_content_size": 993149, "last_modified": "2016/12/08 22:58:37 +0000", "sharing": "private", "tag_list": "Folk \"Pedal Steel\" hello", "permalink": "beyond-the-screen", "streamable": true, "embeddable_by": "all", "downloadable": false, "purchase_url": null, "label_id": null, "purchase_title": null, "genre": "Electronic", "title": "Beyond the Screen", "description": "", "label_name": null, "release": "", "track_type": null, "key_signature": null, "isrc": null, "video_url": null, "bpm": null, "release_year": null, "release_month": null, "release_day": null, "original_format": "mp3", "license": "all-rights-reserved", "uri": "https://api.soundcloud.com/tracks/296005616?secret_token=s-6AMBa", "user": { "id": 101050993, "kind": "user", "permalink": "asweinstein", "username": "Alexander Seth", "last_modified": "2016/12/09 03:01:45 +0000", "uri": "https://api.soundcloud.com/users/101050993", "permalink_url": "http://soundcloud.com/asweinstein", "avatar_url": "https://i1.sndcdn.com/avatars-000281865754-nri1qm-large.jpg" }, "attachments_uri": "https://api.soundcloud.com/tracks/296005616/attachments", "permalink_url": "http://soundcloud.com/asweinstein/beyond-the-screen/s-6AMBa", "artwork_url": null, "waveform_url": "https://w1.sndcdn.com/rdGwuQ37GPml_m.png", "stream_url": "https://api.soundcloud.com/tracks/296005616/stream?secret_token=s-6AMBa", "playback_count": 6, "download_count": 0, "favoritings_count": 2, "comment_count": 0

@alexweinstein
Copy link
Author

@diurnalist I don't understand. Is there any other way to call a private playlist and stream the tracks?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants