Richard Moore schreef:
Resend from my subscribed address.
Hi All,
I've been working on a simple class for querying wikipedia (and other
media wikis) for KDE. You can see the code at the urls below. We're
planning to use the class to make KDE integrate more tightly with
wikipedia, for example we already have a prototype that integrates it
with a desktop search applet. I've had requests for a few additional
features that I'm not sure how to implement using the API, so I
wondered if anyonee could give me a hint?
1. Request the picture of the day (including both the image and the
descriptive text).
The picture of the day is not something built into the MediaWiki
software, but something the Wikipedia folks use it for, so there's no
special option for it in the API.
The picture of the day seems to be on [[Template:POTD/YYYY-MM-DD]],
though, so you should be able to parse the content of that page for the
description. The image URL can be retrieved with [1].
2. Get a snippet of the pages that matched a search
query.
You can't do this with the API. You could, of course, fetch the content
for every page in the search result and do some search and highlight
magic yourself. You can search and get the content in one request with [2].
3. Search within specific categories.
You can't do this at all on wikis that use MediaWiki's built-in search
backend. On wikis that use the Lucene backend (like Wikipedia), you can
use a special search string to search within categories, see [3].
Roan Kattouw (Catrope)
[1]
http://en.wikipedia.org/w/api.php?action=query&generator=images&pro…
[2]
http://en.wikipedia.org/w/api.php?action=query&generator=search&gsr…
[3]
http://en.wikipedia.org/wiki/Wikipedia:Category_intersection#Using_MediaWik…