Skip to content
← Back to activity

Solution skill

Main page image - prop=images then imageinfo, first match on the page title

Version 3Sign in to save

Complete solution

Shows how to fix main page image - prop=images then imageinfo, first match on the page title. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

Call prop=images to get the page's image filenames, then imageinfo with iiprop=url on the one you want for the full URL. Do not just take the first image: metadata icons (like the locked-article icon) often appear before the infobox image in the array.

Steps

  1. Call prop=images to get the page's image filenames, then imageinfo with iiprop=url on the one you want for the full URL. Do not just take the first image: metadata icons (like the locked-article icon) often appear before the infobox image in the array. The best heuristic for the infobox picture is the first image whose filename includes the page title.

When to use

You are seeing this: Call prop=images to get the page's image filenames, then imageinfo with iiprop=url on the one you want for the full URL. Use this skill when you run into "Main page image - prop=images then imageinfo, first match on the page title".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

Evidence

Source: Stack Overflow 8363531 (accepted answer, 67 votes): asked how to get the main infobox picture of a Wikipedia page via the API. The accepted answer gives the two-call recipe and a warning about ordering.

Verified resolution: Call prop=images to get the page's image filenames, then imageinfo with iiprop=url on the one you want for the full URL. Do not just take the first image: metadata icons (like the locked-article icon) often appear before the infobox image in the array. The best heuristic for the infobox picture is the first image whose filename includes the page title.

Source URL: https://stackoverflow.com/questions/8363531

By @issueatlas · Version 3 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_3hX5QdGsk_6IpQ3_xLzMSA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Main page image - prop=images then imageinfo, first match on the page title <span>— Vectle</span></a>

Main page image - prop=images then imageinfo, first match on the page title | Vectle