维基百科 API - 是否有通用的“音乐”?类别?
我对维基百科 API 有疑问。我正在使用 openSearch 来获取带有维基百科页面链接的结果。不过开放搜索似乎不支持+incategory。更重要的是,我想寻找音乐艺术家(乐队、独唱歌手和所有其他类型的音乐家)。但是我找不到任何名为“音乐”的类别。类别过于具体(即 20 世纪 80 年代的音乐团体、独唱歌手等)。然而,当您查看维基百科的消歧页面时,例如针对后代,您可以看到“在音乐中”:
http://en.wikipedia.org/wiki/Offspring_%28disambiguation%29
总结一下:
A) 如何通过 action=opensearch 使用类别?我需要此操作,因为我需要维基百科网址,但我不知道如何以其他方式检索它。
B) 如何设置“音乐”这样的通用类别?
I have a problem with Wikipedia API. I am using openSearch to get results with links to wikipedia pages. However open search doesn't seem to support +incategory. What is more, I would like to search for music artist (bands, solo singer and all other type of musicians). However I can't find any category named 'music'. The categories are too specific (i.e. 1980s music groups, solo singers etc.). However when you look at disambiguation page of wikipedia for example for offspring you can see this 'in music':
http://en.wikipedia.org/wiki/Offspring_%28disambiguation%29
So to sum up:
A) how can I use categories with action=opensearch? I need this action because I need the wikipedia url and I don't know how to retrieve this in another way.
B) how to set up a general category like 'music'?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
A) 维基百科的 OpenSearch 实现似乎仅对页面标题进行前缀搜索。无法指定要查看的类别。您应该查看
action=query&list =搜索
代替。请注意,您可以通过简单地百分比编码轻松地从页面标题创建维基百科网址并将其附加到http://en.wikipedia.org/wiki/
。B)正如您所指出的,维基百科的分类系统通常会避开“音乐”等宽泛的类别,而倾向于更具体的层次结构。目前还没有办法在类别的子类别中进行搜索。您可以通过说服维基百科社区改变他们做事的方式来“设置”这样一个类别(转到此处),但您不太可能取得任何成功。
您可能在消歧页面上看到的“音乐中”与您可以查询或搜索的类别无关,它只是页面中用于组织列表的部分,与部分标题“姐妹站点”没有什么不同在Wikipedia 关于 Stack Overflow 的文章中。
A) It appears that Wikipedia's OpenSearch implementation does a prefix search on page titles only. There is no way to specify categories to look in. You should look into
action=query&list=search
instead. Note that you can easily create a Wikipedia url from the page title by simply percent-encoding it and appending it tohttp://en.wikipedia.org/wiki/
.B) As you've noted, Wikipedia's categorization system generally eschews broad categories such as "Music" in favor of more specific hierarchies. At this time, there is no way to search in subcategories of a category. You could "set up" such a category by convincing the Wikipedia community to change the way they do things (go here), but you're unlikely to meet with any success.
The "In music" you might see on a disambiguation page has nothing to do with categories you might be able to query or search on, it's just a section in the page used to organize the list no different from the section header "Sister sites" in Wikipedia's article about Stack Overflow.