编程语言
首页 > 编程语言> > python – SoundCloud API – 播放计数小于实际计数

python – SoundCloud API – 播放计数小于实际计数

作者:互联网

我通过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)

最佳答案:

通过API报告时,播放计数不正确存在问题.

我在通过/ me端点获取活动数据时遇到过这种情况,并且喜欢提一对.

第一张图显示了访问soundcloud小部件中当前播放曲目返回的声音时返回的信息

Information when accessing via the "Sound" returned for the currently playing track in the soundcloud widget

通过api为me / activities端点返回的信息

information for the same track via the /me/activities endpoint of the API for

标签:python,soundcloud,api
来源: https://codeday.me/bug/20190516/1115764.html