Page MenuHomePhabricator

prop=images with revids parameter does not return the images as of the specified revision.
Closed, InvalidPublic

Description

Hi, I'm trying to use the MediaWiki API to compare the sets of media items across different revisions of the same page. For that, I thought I'd use the Images API and pass it different revids parameters, then compare the results.

Consider, for example, this edit which adds an image to my User page. The old revision is 817810268 and the new is 999395482.

Expected result:

https://en.wikipedia.org/w/api.php?action=query&revids=817810268&format=json&prop=images and https://en.wikipedia.org/w/api.php?action=query&revids=999395482&format=json&prop=images should give me different results. The former should return no images, and the latter should tell me there is now an image.

Actual result:

Both return the image that is currently there.

It looks like the revids parameter is used only for revolving the page id. Is this intended behavior? If so, is there some other recommended way to achieve what I need with the current API?

Event Timeline

revids is used to determine the pageids/titles and prop=images can only return the files used by the current version, because only these are stored extra in the database to query by api module or special page (Special:WhatLinksHere)

To get the result of old revisions, the old revision needs to be parse

https://en.wikipedia.org/w/api.php?action=parse&oldid=817810268&format=json&prop=images

Oh nice, thanks for the quick and helpful response! This pretty much solves my problem.

Just one follow-up question please - I would also like to distinguish between images and videos in the edits, and likely disregard audio items. For that, my plan was to use the images as a generator to prop=imageinfo in the Query API, like so:

https://en.wikipedia.org/w/api.php?action=query&titles=Albert_Einstein&format=json&prop=imageinfo&generator=images&iiprop=mediatype

Now that I need to use the Parse API, it looks like I'll need the one Parse call and then a few Query calls to get the imageinfo of batches of the returned images. Is that correct, or is there perhaps some way to use the results of a Parse as a generator for a Query?

There is no way to use the output of parse API as generator. You have to query them. If first getting the current images than only the missing one needs a query (or none if nothing changes)

Aklapper changed the task status from Resolved to Invalid.Jan 11 2021, 8:19 PM