Soundcloud API is returning 403 on some tracks

╄→гoц情女王★ 提交于 2019-11-29 13:27:55

using this url, working perfectly sir. Try this. :D

https://api.soundcloud.com/tracks/TRACK_ID/stream?client_id=CLIENT_ID

I have been investigating this issue for some time now, and I discovered something which at least solves my situation, dunno if it will solve yours.

The Revelation: If you do a head request with curl (-I option) then it seems to always return with a 200/300 range response.

Why it works: I am streaming Soundcloud tracks with URLs like https://api.soundcloud.com/tracks/TRACK_ID/stream?client_id=CLIENT_ID in an iOS app using FreeStreamer. The stream was failing on exactly those tracks for which curl -v returned 403 for the tracks URL (it returns 401 for the stream URL). So to solve my situation, I perform a head request which gives 302 Found, extract the mp3 URL, and I use that to stream instead of the original URL.

I consider this a bug of the library (since it should be able to handle any 302) and I created an issue for it.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!