我通过python SDK使用soundcloud api。
当我通过搜索'获取曲目数据时, track属性' playback_count'似乎是 小于网上看到的实际数量。
如何避免此问题并获取实际的playback_count ??
(来自 这首曲目的playback_count给了我2700, 但它在网上显示时实际上是15k https://soundcloud.com/drumandbassarena/ltj-bukem-soundcrash-mix-march-2016 )
注意:评论或喜欢不会出现此问题。
以下是我的代码
##Search##
tracks = client.get('/tracks', q=querytext, created_at={'from':startdate},duration={'from':startdur},limit=200)
outputlist = []
trackinfo = {}
resultnum = 0
for t in tracks:
trackinfo = {}
resultnum += 1
trackinfo["id"] = resultnum
trackinfo["title"] =t.title
trackinfo["username"]= t.user["username"]
trackinfo["created_at"]= t.created_at[:-5]
trackinfo["genre"] = t.genre
trackinfo["plays"] = t.playback_count
trackinfo["comments"] = t.comment_count
trackinfo["likes"] =t.likes_count
trackinfo["url"] = t.permalink_url
outputlist.append(trackinfo)
答案 0 :(得分:3)
There is an issue with the playback count being incorrect when reported via the API.
I have encountered this when getting data via the /me endpoint for activity and likes to mention a couple.
The first image shows the information returned when accessing the sound returned for the currently playing track in the soundcloud widget
Information returned via the api for the me/activities endpoint
答案 1 :(得分:3)
查看SoundCloud网站,他们实际上调用了API的第二个版本来填充用户页面上的曲目列表。它与文档版本类似,但不完全相同。
如果您向https://api-v2.soundcloud.com/stream/users/[userid]?limit=20&client_id=[clientid]发出请求,那么您将获得一个JSON对象,显示您在网络上看到的相同数字。
由于这是一个未记录的版本,我确信它会在下次更新网站时发生变化。