如何使用API​​从Wikipedia页面获取“科学分类”信息?

我要查询的文章是:https://en.wikipedia.org/wiki/Aplomado_falcon

通过使用以下格式输入搜索词,我可以使用它们的api获取介绍信息和图像:https://en.wikipedia.org/api/rest_v1/page/summary/[my_search_term](在我的情况下为:https://en.wikipedia.org/api/rest_v1/page/summary/Aplomado_falcon

这将返回:

{
type: "standard",title: "Aplomado falcon",displaytitle: "Aplomado falcon",namespace: {
id: 0,text: "",},wikibase_item: "Q773651",titles: {
canonical: "Aplomado_falcon",normalized: "Aplomado falcon",display: "Aplomado falcon",pageid: 1594971,thumbnail: {
source: "https://upload.wikimedia.org/wikipedia/commons/thumb/2/21/Aplomado_Falcon_portrait.jpg/213px-Aplomado_Falcon_portrait.jpg",width: 213,height: 320,originalimage: {
source: "https://upload.wikimedia.org/wikipedia/commons/2/21/Aplomado_Falcon_portrait.jpg",width: 517,height: 775,lang: "en",dir: "ltr",revision: "976684434",tid: "a872bb90-f494-11ea-b097-e5e16a6eb297",timestamp: "2020-09-04T11:10:10Z",description: "species of falcon",description_source: "central",content_urls: {
desktop: {
page: "https://en.wikipedia.org/wiki/Aplomado_falcon",revisions: "https://en.wikipedia.org/wiki/Aplomado_falcon?action=history",edit: "https://en.wikipedia.org/wiki/Aplomado_falcon?action=edit",talk: "https://en.wikipedia.org/wiki/Talk:Aplomado_falcon",mobile: {
page: "https://en.m.wikipedia.org/wiki/Aplomado_falcon",revisions: "https://en.m.wikipedia.org/wiki/Special:History/Aplomado_falcon",edit: "https://en.m.wikipedia.org/wiki/Aplomado_falcon?action=edit",talk: "https://en.m.wikipedia.org/wiki/Talk:Aplomado_falcon",extract: "The aplomado falcon is a medium-sized falcon of the Americas. The species' largest contiguous range is in South America,but not in the deep interior Amazon Basin. It was long known as Falco fusco-coerulescens or Falco fuscocaerulescens,but these names are now believed to refer to the bat falcon. Its resemblance in shape to the hobbies accounts for its old name orange-chested hobby. Aplomado is an unusual Spanish word for "lead-colored",referring to the blue-grey areas of the plumage – an approximate English translation would be "plumbeous falcon". Spanish names for the species include halcón aplomado and halcón fajado ; in Brazil it is known as falcão-de-coleira.",extract_html: "<p>The <b>aplomado falcon</b> is a medium-sized falcon of the Americas. The species' largest contiguous range is in South America,but not in the deep interior Amazon Basin. It was long known as <i>Falco fusco-coerulescens</i> or <i>Falco fuscocaerulescens</i>,but these names are now believed to refer to the bat falcon. Its resemblance in shape to the hobbies accounts for its old name <b>orange-chested hobby</b>. <i>Aplomado</i> is an unusual Spanish word for "lead-colored",referring to the blue-grey areas of the plumage – an approximate English translation would be "plumbeous falcon". Spanish names for the species include <i><b>halcón aplomado</b></i> and <i><b>halcón fajado</b></i> ; in Brazil it is known as <i><b>falcão-de-coleira</b></i>.</p>",}

如何通过api以json格式返回科学信息以及保护状态以及上述信息?

iCMS 回答:如何使用API​​从Wikipedia页面获取“科学分类”信息?

Wikipedia的API将不提供与页面内容相关的结构化数据。对于此类服务,请检查wikidata。您提供的API的输出包含:

wikibase_item: "Q773651",

这是Wikidata实体的密钥,请参见https://www.wikidata.org/wiki/Q773651

另一种方法是获取原始Wikipedia页面内容,并使用自定义解析器分析模板内容。

本文链接:https://www.f2er.com/1528337.html

大家都在问