简体   繁体   English

如何在Python中访问SoundCloud-Stream URL?

[英]How can I access SoundCloud-Stream URLs in Python?

Some time ago I wrote a little tool for a friend of mine. 前段时间我为我的一个朋友写了一个小工具。 I retrieved all stream-links (like this ) from a soundlist and downloaded all those with a small python script. 我从声音列表中检索了所有流链接( 如此 )并下载了所有带有小python脚本的链接。

Since begin of March, soundcloud must have changed something, and now my cronjob recieves 401 Unauthorized errors. 从3月开始,soundcloud必定已经改变了一些东西,现在我的cronjob收到了401 Unauthorized错误。 I've read through the soundcloud API, but that whole Access Token does not really fit my needs. 我已经阅读了soundcloud API,但整个Access Token并不能满足我的需求。

Has anyone of you an idea of easily dealing with this problem? 你有谁想要轻易解决这个问题? Thanks. 谢谢。

As Makoto said, 401 seems like you have lost priviledges to access through your OAuth token so I would double check to make sure your app is still available and that your tokens are correct. 正如Makoto所说,401似乎已经失去了通过您的OAuth令牌访问的权限,所以我会仔细检查以确保您的应用程序仍然可用并且您的令牌是正确的。 You can check on the Your Apps Page. 您可以查看您的应用页面。

Also, I noticed that your url seemed a bit different than what the SC api shows. 另外,我注意到你的网址似乎与SC api显示的有点不同。 Once you resolve to get a proper track id, the convention for a stream url is: 一旦您决定获取正确的跟踪ID,流URL的约定是:

http://api.soundcloud.com/tracks/{id}/stream

This can be found in their track documentation . 这可以在他们的跟踪文档中找到。

Read the documentation here . 阅读此处的文档。 You have to add your client_id parameter to the stream url and then you will be redirected to the stream link (mp3). 您必须将您的client_id参数添加到流URL,然后您将被重定向到流链接(mp3)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM