的SoundCloud搜索API忽略了时间过滤器? [英] soundcloud search api ignoring duration filter?
问题描述
我尝试了一下用的SoundCloud API ...酷的东西,但是:
它看起来像当我尝试应用过滤器来搜索歌曲,该API的忽略时间...
见下文code剪断。其目的是寻找在过去2个月(10)恍惚轨道人气排序,即有一个多小时的持续时间....据我所知,持续时间在毫秒到指定(因此在* 100)
顺便说一句,在的SoundCloud对象是SC,用我的API密钥初始化
难道我做错了什么,因为那时我看控制台,最轨迹是的少,然后一个小时?
谢谢!
桑德
Soundcloud.get(/曲目,{
风格:恍惚,精神恍惚,
命令:辣味,
限制:10,
created_at:{
自:时刻()减去(2,'月')格式(YYYY-MM-DD)。
},
持续时间:{
来自:3600 * 1000 //秒* 1000
}
},功能(轨道){
的console.log('轨道',轨道);
});
我建议你使用时间[从]
,而不是你的对象定义。这是我使用的SoundCloud和给了我一贯的匹配结果。
其次,在 created_at
参数的格式更改为 .format(YYYY-MM-DD HH:MM:SS)
。
I'm experimenting a bit with the soundcloud api... Cool stuff, however:
It looks like when I try to apply a filter to search for tracks, the api ignores the duration...
See code snipper below. The purpose is to search for (10) trance tracks in the last 2 months, ordered by popularity, that have a duration of more than an hour.... As far as I know, the duration has to be specified in milliseconds (hence the * 100) Btw, The soundcloud object is SC, initialised with my API key
Am I doing something wrong, because then I look at the console, most tracks are less then an hour?
Thanks!
Sander
Soundcloud.get("/tracks", {
genres: "Trance,trance",
order: "hotness",
limit: 10,
created_at: {
from: moment().subtract(2, 'months').format("YYYY-MM-DD")
},
duration: {
from: 3600 * 1000 // seconds * 1000
}
}, function(tracks) {
console.log('tracks', tracks);
});
I'd recommend you to use "duration[from]"
instead of your object definition. It's what I use and SoundCloud gives me consistently matching results.
Secondly, change your format in the created_at
param to .format("YYYY-MM-DD HH:mm:ss")
.
这篇关于的SoundCloud搜索API忽略了时间过滤器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!