/ me / activities查询只返回了8个活动 - 其余的是哪里?

时间:2017-03-25 12:46:41

标签: http soundcloud

当我查询/ me / activities时,返回的JSON只包含8个轨道,然后迭代next_href游标属性返回相同的重复8个轨道。我几周前使用了与最近相同的查询,并且成功地能够返回数百首歌曲,但我现在仅限于8首歌曲。

重新创建:

https://api.soundcloud.com/me/activities?limit=10&oauth_token=<token>

https://api.soundcloud.com/me/activities?limit=10&oauth_token=<token>&cursor=<cursor>

提前致谢!

1 个答案:

答案 0 :(得分:0)

自3月底以来我还没有触及过这个问题,今天无法复制这个问题。我使用Souncloud-Python包装器返回1000多首歌曲:

import soundcloud
client = soundcloud.Client(<client_id>, <client_secret>,
                           <username>, <password>)

total_activities = 0
next_href = '/me/activities?limit=25'

# Continue to fetch songs until no additional link is available
while next_href is not None:
    activities = client.get(next_href)
    per_req_count = 0
    for activity in activities.collection:
        # print "Found:", activity.type
        per_req_count += 1
    print('> per_req_count = {}'.format(per_req_count))
    total_activities += per_req_count
    next_href = activities.next_href

print('\n> total_activities = {}'.format(total_activities))