如何使用 Sound Cloud API 按标签搜索特定用户的曲目? [英] How to search specific user's tracks by tag with the Sound Cloud API?

查看:42
本文介绍了如何使用 Sound Cloud API 按标签搜索特定用户的曲目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想按仅与我的用户名(即皇家歌剧院)相关的标签搜索曲目.

I want to search for tracks by tag relating only to my user name i.e. the Royal Opera House.

例如:

http://api.soundcloud.com/users/royaloperahouse/tracks/?client_id=238947HSGDHSDG&tags=eric

告诉我我需要使用 q 参数.为了幽默,我搜索:

tells me I need to use a q parameter. To humour it I search:

http://api.soundcloud.com/users/royaloperahouse/tracks/??client_id=238947HSGDHSDG&tags=eric&q=e

并简单地从整个 Sound Cloud 中获取声音列表,而不仅仅是与我的用户相关的声音.同样,如果我尝试搜索曲目 API(而不是用户)并使用 &user_id 限制查询,我会得到与所有用户相关的视频,而不是特定于皇家歌剧院的视频.

and simply get a list of sounds from the whole of Sound Cloud not the ones relating to just my user. Similarly if I try and search the tracks API (not by users) and limit the query with &user_id I get videos relating to all users not one specific to the Royal Opera House.

最终目标是找到皇家歌剧院上传的与特定艺术家相关的所有曲目.目前我们解决这个问题的方法是获取我们所有上传的曲目(目前有 37 个)并遍历这些曲目以通过相关标签匹配曲目.显然,随着我们音乐列表的增长,这将开始成为一个问题.

The ultimate aim is to find all tracks that the Royal Opera House has uploaded relating to a specific artist. At the moment the way we are solving it is by getting all of our uploaded tracks (37 at present) and iterating through those to match the tracks by the relevant tag. Obviously as our music list grows this will start to be a problem.

谢谢.

推荐答案

我之前没有使用过这个 API,但经过几次测试后我想我发现了你的问题.

I haven't used this API before, but after a few tests i think i've found your problem.

您不应该使用 users 作为第一个网址段,因为您不是在搜索用户,而是在搜索按用户名和标签过滤的曲目.

You shouldn't use users as the first url segment because you aren't searching for users, you are searching for tracks filtered by username and tags.

改为使用 tracks 作为第一个 url 段,并使用 q 参数过滤用户名.然后您也可以使用 tags 参数.

Instead use tracks as the first url segment, and use the q parameter to filter the username. Then you can use use the tags parameter as well.

测试这个网址:http://api.soundcloud.com/tracks?q=用户名&tags=tag

SC.get('/tracks/', {q:'royaloperahouse', tags: 'insights' },  function(result) { 
    console.log(result[0].tag_list);
});

老实说,我仍然不理解 q 参数.在 API 文档中,您可以在轨道、用户等中找到有关它的参考,在搜索页面中他们也谈到了它,但我没有找到任何关于 q 参数在每种查询类型中过滤什么的文档.轨道中是用户名(和可能的用户 ID)

To be honest i still do not understand the q parameter. In API documentation you find references about it in tracks, users, etc and in search page they talk about it too but i haven't found any documentation about what the q parameter is filtering in each query type. In tracks is the username (and possible user id)

如果您正在使用此 API,您应该向他们的 google 组中的 soundcloud 团队询问更多此参数的含义.

If you are consuming this API, you should ask soundcloud team in their google group more the meaning of this parameter.

这篇关于如何使用 Sound Cloud API 按标签搜索特定用户的曲目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆