I'm trying to query wikipedia using MediaWiki api with php (and Curl), in order to search for images that are being used in various articles by a specific search term. For example - search for 'panda', but get only images that are being used somewhere and be able to go to the articles. I am able to search for images generally using:
and I know that basically this should show the usage:
Trying the above does not give me the result I need - I can see a list of images, but I cannot know if or where they are being used.
Can anyone assist?
list=imageusage
does not show cross-wiki usage; you'll need prop=globalusage
for that. Which is also conveniently a prop module, so it can be folded into the first query using allimages
as a generator:
action=query&generator=allimages&gailimit=100&gaifrom=Panda&prop=globalusage
(Omitted prop=images
since it does not seem to have any useful purpose.)