在的SoundCloud API指南(https://developers.soundcloud.com/docs/api/guide#pagination) 阅读超过100件的数据给出的示例的SoundCloud API的Python的问题如下:带有链接的分区
# get first 100 tracks
tracks = client.get('/tracks', order='created_at', limit=page_size)
for track in tracks:
print track.title
# start paging through results, 100 at a time
tracks = client.get('/tracks', order='created_at', limit=page_size,
linked_partitioning=1)
for track in tracks:
print track.title
我敢肯定这是错误的我发现'tracks.collection'需要引用而不仅仅是'track'。基于GitHub的蟒蛇的SoundCloud API维基应该更像这样:
tracks = client.get('/tracks', order='created_at',limit=10,linked_partitioning=1)
while tracks.collection != None:
for track in tracks.collection:
print(track.playback_count)
tracks = tracks.GetNextPartition()
这里,我从最后一行除去缩进(我认为这是一个维基的错误是在for循环,这使得对我没有意义)。这适用于第一个循环。但是,这不适用于连续页面,因为找不到“GetNextPartition()”函数。我试过最后一行:
tracks = tracks.collection.GetNextPartition()
...但没有成功。
也许我正在混合版本?但我试图在从这里下载版本后使用Python 3.4运行:https://github.com/soundcloud/soundcloud-python
任何帮助非常感谢!