Soundcloud API 不明确支持使用 json 进行分页 [英] Soundcloud API doesn't explicitly support pagination with json

查看:17
本文介绍了Soundcloud API 不明确支持使用 json 进行分页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用的具体示例:

Specific example I was working with:

http://api.soundcloud.com/users/dubstep/track.json?client_id=YOUR_CLIENT_ID

您将获得他们的前 50 首曲目,但没有像您在 xml 版本.

You'll get their first 50 tracks, but there is not next-href object like what you see in the xml version.

但是,您可以使用 offset 和 limit 并且它按预期工作-但是然后我需要盲目地"爬过轨道,直到没有更多轨道,这与 XML 版本不同,它为您提供下一页"结果.我什至不会注意到它被分页,除非我在搜索 json 对象时偶然发现有 50 首曲目(甚至可疑).

However, you can use offset and limit and it works as expected- but then I would need to "blindly" crawl through tracks until there are no more tracks, unlike with the XML version which gives you the "next page" of results. I wouldn't have even noticed it was paginated except by chance when I was searching the json object and noticed there was exactly 50 tracks (which is suspiciously even).

是否有计划支持 json 中的 next-href 标签?我错过了什么吗?是它丢失的错误吗?

Is there a plan to support the next-href tag in json? Am I missing something? is it a bug that it's missing?

推荐答案

有一个未公开的参数,您可以使用 linked_pa​​rtitioning=1,它会将 next_href 添加到响应中.

There is an undocumented parameter you can use linked_partitioning=1, that will add next_href to the response.

http://api.soundcloud.com/users/dubstep/tracks.json?client_id=YOUR_CLIENT_ID&linked_pa​​rtitioning=1

这篇关于Soundcloud API 不明确支持使用 json 进行分页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆