3

When I ask the MediaWiki API to provide images for each title, it just returns images for the first specified title. For example, the query:

http://en.wikipedia.org/w/api.php?format=jsonfm&action=query&titles=Id%20Software|Doom%203|Wolfenstein%203D|Quake%20II|John%20D.%20Carmack|John%20Romero|Doom%20(video%20game)|Quake%20(video%20game)|Commander%20Keen|Rage%20(video%20game)&prop=info|images

returns info for each page but images only for the first. Why?

Ilmari Karonen
  • 49,047
  • 9
  • 93
  • 153
sadensmol
  • 93
  • 1
  • 7

1 Answers1

2

Because it is just the first page of results, notice the query-continue at the bottom. To get the second page, you would need to repeat your query with the query-continue added (e.g. something like &imcontinue=15526|Doom_ingame_1.png).

But a better solution would be to change the size of the page by adding &imlimit=max. In this case, this means all results fit into one page, but that won't be the case always.

It might be better if you used some sort of library (depending on what language are you using), which could handle paging for you automatically.

svick
  • 236,525
  • 50
  • 385
  • 514
  • 1
    Also note that, since this particular result set only includes a continuation entry for `images`, you don't need to (and, in fact, shouldn't) repeat the `info` part of the query, so your next query URL should end in `&prop=images&imcontinue=15526|Doom_ingame_1.png`. See the [MediaWiki API documentation for continuing queries](http://www.mediawiki.org/wiki/API:Query#Continuing_queries) for more details. (As svick notes, using an MW API client library should take care of all this for you.) – Ilmari Karonen Jan 07 '13 at 21:40