微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

SoundCloud 抓取问题soundcloud-lib 错误;HTTPError: HTTP Error 403: Forbidden

如何解决SoundCloud 抓取问题soundcloud-lib 错误;HTTPError: HTTP Error 403: Forbidden

我正在尝试抓取新音乐形式的声音并通过电报组上传它们,因此,我问了 here 并没有找到答案,我尝试使用另一个 Python SoundCloud 抓取模块通过以下命令,也可以在 this Colab page 上运行:

enter image description here

pip install soundcloud-lib

from sclib import SoundcloudAPI,Track,Playlist

api = SoundcloudAPI()
playlist = api.resolve('https://soundcloud.com/razhavaniazha-com')

assert type(playlist) is Playlist

for track in playlist.tracks:
    filename = f'./{track.artist} - {track.title}.mp3'
    with open(filename,'wb+') as fp:
        track.write_mp3_to(fp)

但是通过运行上面的代码,得到这个错误

HTTPError                                 Traceback (most recent call last)
<ipython-input-6-023e08e56a22> in <module>()
      2 
      3 api = SoundcloudAPI()
----> 4 playlist = api.resolve('https://soundcloud.com/razhavaniazha-com')
      5 
      6 assert type(playlist) is Playlist

9 frames
/usr/lib/python3.7/urllib/request.py in http_error_default(self,req,fp,code,msg,hdrs)
    647 class HTTPDefaultErrorHandler(BaseHandler):
    648     def http_error_default(self,hdrs):
--> 649         raise HTTPError(req.full_url,hdrs,fp)
    650 
    651 class HTTPRedirectHandler(BaseHandler):

HTTPError: HTTP Error 403: Forbidden

我已经在我的电脑上尝试过这个代码,但我得到了同样的错误,我猜 SoundCloud 需要一个客户端 ID 来进行音乐抓取。但是 SoundCloud 没有通过使用 this video 指令给出客户端 ID 并给出以下消息:

enter image description here

由于请求量大,SoundCloud 应用注册 最近收到,我们将不再处理API申请 此时请求。我们正在努力重新评估我们的流程 提高效率。

所以,我问这里了解如何在没有客户端 ID 的情况下进行操作?

在这里问:

https://github.com/3jackdaws/soundcloud-lib/issues/29

更新:

奇怪的是它是由 python youtube-dl 模块完成的,你可以通过 this post 看到它并通过 the below colab page 进行云测试:

enter image description here

谢谢。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。