Accessing main picture of wikipedia page by API
It returns an array of image filenames that are used in the parsed page. You then have the option of making another API call to find out the full image URL, e.g.:
or to calculate the URL via the filename's hash.
Unfortunately, while the array of images returned by
prop=images is in the order they are found on the page, the first can not be guaranteed to be the image in the info box because sometimes a page will include an image before the infobox (most of the time icons for metadata about the page: e.g. "this article is locked").
Searching the array of images for the first image that includes the page title is probably the best guess for the infobox image.
You can get the thumbnail of any wikipedia page using
prop=pageimages. For example:
And you will get the thumbnail full URL.