gpt4 book ai didi

python - Soundcloud API 未通过 Python 返回播放列表中的所有轨道

转载 作者:太空狗 更新时间:2023-10-30 01:06:31 24 4
gpt4 key购买 nike

我最近开始使用 Soundcloud API 开发一个简单的应用程序来保存播放列表中的数据。但是,在我看来,并不是播放列表中的所有轨道都会被返回。

我正在使用以下代码:

import soundcloud, shelve, time

client = soundcloud.Client(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET,
username=E-MAIL,
password=PASSWORD)

playlists = client.get('/users/24196709/playlists', limit=1)

tracknames = []
trackids= []

for pl in playlists:
for track in pl.tracks:
print(track['title'])
tracknames.append(track['title'])
trackids.append(track['id'])

print(tracknames)

在此播放列表中使用它:https://soundcloud.com/michiel-tammeling/sets/icecubes其中包含 13 个轨道,但代码仅返回 11 个。

如有任何帮助,我们将不胜感激。

最佳答案

不幸的是,这无法解决。关于这个问题的话题已经很多了。问题是播放列表 API 返回播放列表中的所有轨道,但轨道 API 仅返回不 protected 轨道。由于您已经找出缺少的 2 条轨道,我对此进行了验证,当您尝试使用轨道 API 时,它们都返回 403。因此,这 2 条轨道无法使用轨道 API 以某种方式访问​​。

更多背景:

SoundCloud Playlist tracks is empty

SoundCloud emailed back saying they have introduced an option for right holders to disable all API access to tracks by default, returning this 403 error when requested. They also said it's understandable that this is a confusing feature, and that they hope to make it more clear.

@nickf the tech lead of soundcloud says:

Yep -- there's many reasons that a track might not show up to you. It could be taken down by the rightsholder of the track, made private or deleted by the uploader, or (and this is the tricky one) blocked in certain territories. Calculating the policies of all of the tracks of a user every time it is fetched isn't quite feasible, so sometimes this number will be inaccurate (depending on who is asking and where they are). – nickf Apr 14 at 22:37

关于python - Soundcloud API 未通过 Python 返回播放列表中的所有轨道,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36755039/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com