Thanks, Platonides.

I tried http://www.mediawiki.org/w/api.php?action=query&prop=images&titles=Albert%20Einstein&format=xml and it gave me no results - here's what I got:

  <?xml version="1.0" ?>
- <api>
- <query>
- <pages>
  <page ns="0" title="Albert Einstein" missing="" />
  </pages>
  </query>
  </api>

I also tried File:Albert%20Einstein and Albert_Einstein as the value for titles, but got similar empty results.

Thanks
Anand

On Fri, Mar 12, 2010 at 2:30 PM, Platonides <platonides@gmail.com> wrote:
Anand Ramanathan wrote:
> Hi,
> I am building an application where I need to find the most relevant
> commons image for a wikipedia page. For example, if the page has an
> infobox with an image that would be the image I want. If not, I would
> look for an image on the page that is also found on a wikimedia commons
> search for that entity. Otherwise, I fall back to the first result from
> wikimedia commons search.
> Is this the best possible algorithm for this requirement?
> I also considered grabbing the first image from the action=render page,
> but there are two problems there:
> 1. action=render is very slow the first time and can become prohibitive
> for my application.

Use prop=images to get the page images.

> 2. the first image on the action=render page's html is often an icon -
> is there a reasonable way to find the actual first "main" image on that
> page?
Maybe create a blacklist of images known to be icons?


_______________________________________________
Mediawiki-api mailing list
Mediawiki-api@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-api