[Mediawiki-api] Get a description about cities

Roan Kattouw roan.kattouw at gmail.com
Wed Feb 3 23:47:57 UTC 2010


2010/2/3 IgalSt <xoxsoft at gmail.com>:
>
> Hello
>
> I have in my DB urls of wikipedia pages for many capital cities around the
> world
> (For example: http://en.wikipedia.org/wiki/London)
>
> I would like to retrieve the short description of the city that all the
> cities have before the "Contents" table.
> I need it in plain text of HTML.
>
> I should I do it?
>
> I have tried using it like that:
> http://en.wikipedia.org/w/index.php?action=render&title=London
>
> But is there a way to retrieve only the short description?
>
You can get the wikitext of the text before the first section with:

http://en.wikipedia.org/w/index.php?action=raw&title=London&section=

Getting just the HTML of a section is not supported, although you can
easily look for <h2> (or another one of h1-h6) and cut off there.

Roan Kattouw (Catrope)



More information about the Mediawiki-api mailing list