Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use wikipedia api if it exists? [closed]

I'm trying to find out if there's a Wikipedia API (I think it is related to the MediaWIki?).

If so, I would like to know how I would tell Wikipedia to give me an article about the new york yankees for example.

What would the REST URL be for this example?

All the docs on this subject seem fairly complicated.

like image 658
chris Avatar asked Jun 08 '09 11:06

chris


People also ask

Is Wikipedia API free?

Wikipedia and other Wikimedia projects are free, collaborative repositories of knowledge, written and maintained by volunteers from around the world. The Wikimedia API gives you open access to add this free knowledge to your projects and apps.

Does Wikipedia have an open API?

Because Wikipedia is built using MediaWiki, which in turn supports an API, Wikipedia does as well. This provides developers code-level access to the entire Wikipedia reference. The goal of this API is to provide direct, high-level access to the data contained in the MediaWiki databases.

How does Wikipedia API work?

Your program sends requests to the API to get access to wiki features. For example, log in to a wiki, create and edit a page, search for a title, search for content text, or parse content. The Action API is available for third-party developers, Wikimedia extension developers, and wiki site administrators.

How do I get data from Wikipedia?

Just extract Wikipedia data via Google Spreadsheets, download all the data from the sheet to your laptop, and open it in Excel or LibreOffice. Google AdWords Keyword Planner suggests keywords with the commercial or transactional intent, unless you dig deep and use highly specific keywords in the input.


1 Answers

You really really need to spend some time reading the documentation, as this took me a moment to look and click on the link to fix it. :/ but out of sympathy i'll provide you a link that maybe you can learn to use.

http://en.wikipedia.org/w/api.php?action=query&prop=revisions&titles=New_York_Yankees&rvprop=timestamp|user|comment|content

That's the variabled you will be looking to get. Your best bet is to know the page you will be after and replace the Wikipedia link part into the title i.e.:

http://en.wikipedia.org/wiki/New_York_Yankees [Take the part after the wiki/]

-->

http://en.wikipedia.org/w/api.php?action=query&prop=revisions&titles=New_York_Yankees&rvprop=timestamp|user|comment|content

[Place it in the title variable of the GET request.

The URL above can do with tweaking to get the different sections you do or do not want. So read the documentation :)

like image 171
Shadi Almosri Avatar answered Sep 24 '22 21:09

Shadi Almosri