SoundCloud API 忽略时长过滤器

SoundCloud API ignoring duration filter

根据 https://developers.soundcloud.com/docs/api/reference#tracks 上的 SoundCloud API 文档,我开始在我的一个项目中编写 SoundCloud API 的实现。我尝试使用以下代码获取 50 条最小长度为 120000 毫秒的特定类型的曲目:

def get_starttracks(genres="Rock"):
    return client.get("/tracks", genres=genres, duration={
        'from': 120000
    }, limit='50')

SoundCloud 使用有效的曲目列表进行响应,但它们的持续时间与给定的过滤器不匹配。

示例:

print(get_starttracks(genres="Pop")[0].fields()['duration'])
> 30000

是 api 忽略了 'duration' 参数还是我的代码中的过滤器有错误?

Ps.: 可能与 soundcloud search api ignoring duration filter? 有关,如果错误不在 python 代码内。

在尝试通过对我的代码进行多次更改来解决此问题后,我终于找到了问题所在:

不是错误。由于 Soundcloud 发布了他们的 "Go+"-Services,一些官方曲目被限制在 30 秒内预览。 API 过滤器似乎比较完整曲目的持续时间,而只是将预览版本发送回客户端(如果您没有订阅 "Go+" and/or 您的应用程序是未登录)。

因此,按持续时间过滤的唯一方法是遍历所有接收到的曲目:

for track in tracks:
    if track.duration <= 30000:
        tracks.remove(track)