meactivities查詢只返回了8個活動 - 其余的是哪里? - Only 8 activities returned for meactivities query - where are the rest? -开发者知识库

 meactivities查詢只返回了8個活動 - 其余的是哪里? - Only 8 activities returned for meactivities query - where are the rest? -开发者知识库,第1张

When I query /me/activities, the returned JSON only includes 8 tracks, then iterating over the next_href cursor attribute returns the same duplicate 8 tracks. I've used the same query as recently as a few weeks ago and was successfully able to return hundreds of songs, but I'm now limited to 8 songs.

當我查詢/ me / activities時,返回的JSON只包含8個軌道,然后迭代next_href游標屬性返回相同的重復8個軌道。我幾周前使用了與最近相同的查詢,並且成功地能夠返回數百首歌曲,但我現在僅限於8首歌曲。

To recreate:

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

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

Thanks in advance!

提前致謝!

1 个解决方案

#1


0  

I haven't touched this problem since the end of March and wasn't able to replicate the issue today. I used the Souncloud-Python wrapper to return 1000 songs:

自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))

最佳答案:

本文经用户投稿或网站收集转载,如有侵权请联系本站。

发表评论

0条回复