1

Is there a way to get the intro content from wikipedia page to my mediawiki page? I was thinking of using wikipedia's api but i dont know how to parse the url on my page and also with templates. I just want a query that will display the introduction part of a wikipedia page on my page?d

4

1 回答 1

1

我使用External_Data Extension和 Wikipedia 的 api 来实现这一点。

API

http://en.wikipedia.org/w/api.php? action=query&prop=extracts&format=json&exintro=&titles=[title of wikipedia page]

我是如何使用它的

{{#get_web_data:
url=http://en.wikipedia.org/w/api.php? action=query&prop=extracts&format=json&exintro=&titles={{PAGENAME}}
|format=JSON|data=extract=extract}}

我如何在页面上显示摘录

{{#external_value:extract}}

但是,我需要弄清楚如何从返回文本中只获取一个段落。可能会使用解析器功能。

于 2015-03-23T22:13:08.630 回答