YourGamerMom
YourGamerMom

Reputation: 377

Wikimedia API: Why does this type of page break my image query?

I'm trying to use the WikiMedia API for this wiki, which say's that it's powered by MediaWiki. use the query:

action=query&format=json&prop=images

Usually, it gives me a list of the images on the page. But for a specific type of page, it doesn't give me images that are clearly on the page. For example:

action=query&format=json&prop=images&titles=Serval

the result contains the images on the page, notably ServalOriginal.jpg. But in this query:

action=query&format=json&prop=images&titles=Serval/Nexon Game

the result does not contain the important image ServalOriginal.jpg, even though it's featured on the page. However, in the similar query:

action=query&format=json&prop=images&titles=Serval/Anime

the result does contain the image in the same place, ServalAnime.jpg, which makes sense given the page.

This appears all over the wiki, but I can't find documentation that would make me expect this result. Why is it doing this, and how can I work around it so that I can get the images I need from all the pages?

Upvotes: 0

Views: 39

Answers (1)

Jan Drewniak
Jan Drewniak

Reputation: 1384

By default, the images prop only returns the first 10 images. To get all available images on a page (maximum 500) use the imlimit property, like this:

https://japari-library.com/w/api.php?action=query&format=json&prop=images&imlimit=500&titles=Serval/Nexon%20Game

Upvotes: 2

Related Questions