维基百科 API - 是否有一个通用的“音乐"类别? [英] Wikipedia API - is there a general 'music' category?

查看:39
本文介绍了维基百科 API - 是否有一个通用的“音乐"类别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对维基百科 API 有疑问.我正在使用 openSearch 来获取带有维基百科页面链接的结果.然而,开放式搜索似乎不支持 +incategory.更重要的是,我想搜索音乐艺术家(乐队、独唱和所有其他类型的音乐家).但是我找不到任何名为音乐"的类别.类别过于具体(即 1980 年代的音乐团体、独唱歌手等).但是,当您查看维基百科的消歧页面时,例如后代,您可以看到在音乐中":

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

总结一下:

A) 如何使用带有 action=opensearch 的类别?我需要这个操作,因为我需要维基百科网址,但我不知道如何以另一种方式检索它.

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) 如何设置像音乐"这样的一般类别?

B) how to set up a general category like 'music'?

推荐答案

A) 似乎维基百科的 OpenSearch 实现只对页面标题进行前缀搜索.无法指定要查看的类别.您应该查看 action=query&list=search 代替.请注意,您可以通过简单的 percent-encoding 从页面标题轻松创建维基百科网址并将其附加到 http://en.wikipedia.org/wiki/.

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 to http://en.wikipedia.org/wiki/.

B) 正如您所指出的,维基百科的分类系统通常会避开诸如音乐"之类的广泛类别,而采用更具体的层次结构.此时,无法在类别的子类别中进行搜索.你可以通过说服维基百科社区改变他们做事的方式来设置"这样一个类别(去在这里),但您不太可能取得任何成功.

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.

这篇关于维基百科 API - 是否有一个通用的“音乐"类别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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