Java 中是否有任何 API 可以访问维基百科数据

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1397938/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-12 11:39:09  来源:igfitidea点击:

Is there any API in Java to access wikipedia data

javamediawikiwikipedia-apimediawiki-api

提问by

I want to know: is there any API or a query interface through which I can access Wikipedia data?

我想知道:是否有任何 API 或查询接口可以让我访问维基百科数据?

回答by Robert Christie

Mediawiki, the wiki platform that wikipedia uses does have an HTTP based API. See MediaWiki API.

Mediawiki,维基百科使用的维基平台确实有一个基于 HTTP 的 API。请参阅MediaWiki API

For example, to get pages with the title stackoverflow, you call

例如,要获取标题为 stackoverflow 的页面,您可以调用

http://en.wikipedia.org/w/api.php?action=query&titles=Stackoverflow

http://en.wikipedia.org/w/api.php?action=query&titles=Stackoverflow

There are some (incomplete) Java wrappers around the API - see the Client Code - Javasection of the API page for more detail.

API 周围有一些(不完整的)Java 包装器 -有关更多详细信息,请参阅API 页面的客户端代码 - Java部分。

回答by Integrating Stuff

I had the same question and the closest I came to an out-of-the-box solution is bliki, hosted at http://code.google.com/p/gwtwiki/. I also wrote an article at Integrating Stuff to help you get started with it: http://www.integratingstuff.com/2012/04/06/hook-into-wikipedia-using-java-and-the-mediawiki-api/

我有同样的问题,最接近现成解决方案的是 bliki,托管在http://code.google.com/p/gwtwiki/。我还在 Integrating Stuff 上写了一篇文章来帮助你开始使用它:http: //www.integratingstuff.com/2012/04/06/hook-into-wikipedia-using-java-and-the-mediawiki-api/

回答by Olivier Faucheux

For the use with Java, try http://code.google.com/p/wiki-java. It is only one class, but a great one!

要与 Java 一起使用,请尝试http://code.google.com/p/wiki-java。这只是一节课,但很棒!

回答by Amin Arab

MediaWiki is a free and open-source wiki software. Originally developed by Magnus Manske and improved by Lee Daniel Crocker, it runs on many websites, including Wikipedia, Wiktionary and Wikimedia Commons.[5][6]

MediaWiki 是一个免费的开源维基软件。它最初由 Magnus Manske 开发并由 Lee Daniel Crocker 改进,可在许多网站上运行,包括 Wikipedia、Wiktionary 和 Wikimedia Commons。[5][6]

There is list of Java libraries that can help you to connect wiki by java code . https://www.mediawiki.org/wiki/API:Client_code#Java

有一系列 Java 库可以帮助您通过 Java 代码连接 wiki。 https://www.mediawiki.org/wiki/API:Client_code#Java

but after use some of them because of their limitations , we try to call REST services from mediawiki directly.

但是在使用了其中的一些之后,由于它们的局限性,我们尝试直接从 mediawiki 调用 REST 服务。