views:

74

answers:

4

If I have the url to the page, how would I get obtain the infobox on the right using mediawiki webservices?

+1  A: 

There is no trivial way to do that. You can try fetching the page content using action=raw, i.e. http://en.wikipedia.org/w/index.php?action=raw&title=Douglas_Jardine Then find the start of the infobox by searching for "{{Infobox". Then find the end by finding the matching "}}", taking into account that the infobox itself can also contain "{{"-"}}" and "{{{"-"}}}" pairs.

Bryan
+1  A: 

Tomxu - what you're talking about is a template - which is simple a page you can include on another page. For the infobox you need to start by looking at Template:Infobox. This gives you detailed instructions.

You can also press edit (or view code) and copy the contents to your own wiki. Bear in mind that templates tend to be in a hierarchy so you might need to copy other templates that Infobox uses (if you want to use them). Each template can be identified with {{}} so e.g. the Infobox template will look like this: {{Infobox}}.

I mentioned a hierarchy: you'll actually find multiple templates that all use Template: Infobox. To find them, just type this into Wikipedia's search field: Template:Infobox and then you'll find multiple examples, e.g. Template:Infobox writer

Update: if you mean Navboxes, then see this information.

Mark Robinson
A: 

In our project we use queries for fetching data from wiktionary like this:

"http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20html%20where%20url%3D%22http%3A%2F%2Fen.wiktionary.org%2Fwiki%2Flife%22%20and%20xpath%3D'%2F%2Fdiv%5B%40id%3D%22bodyContent%22%5D'&format=xml&diagnostics=false&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback=recwiki"

I have no comprehensive understanding of it, but it works. Output result can de filtered using jquery or something else.

igor
+2  A: 

I you just want to parse the infobox or you want to get some digested data, a look at the DBPedia project: http://dbpedia.org

It scans the infoboxes in WP to create a RDF database from Wikipedia: http://dbpedia.svn.sourceforge.net/svnroot/dbpedia/trunk/extraction/

Pierre