3

I would like to use the MediaWiki API to get the copyright info for an image. When you click on an image in Wikipedia, the page with the image is opened containing a button "more details". Clicking this button you come to a page which contains a "Use this file on the web" link. Clicking this link (runs the script "stockPhoto.call_web();" which) shows a window with the information I would like to get via a MediaWiki API call.

I have been looking at "action=query" and all kinds of properties, but couldn't find the desired information. Any idea?

Nemo
  • 2,441
  • 2
  • 29
  • 63
Gerhard
  • 1,342
  • 2
  • 12
  • 23

1 Answers1

4

You can combine action=query with prop=imageinfo and iiprop=extmetadata to get the information. Perhaps also combine it with iiextmetadatafilter=LicenseShortName to get it more readable, example: https://en.wikipedia.org/w/api.php?format=jsonfm&action=query&titles=File:30C3_Commons_Machinery_2.jpg&prop=imageinfo&iiprop=extmetadata%7Curl&iiextmetadatafilter=LicenseShortName

However, not all image files have data like this yet but probably a large enough amount to be useful. Do prepare to find images with no answer.

Ainali
  • 1,613
  • 13
  • 23
  • Thanks Ainali, LicenseShortName and LicenseUrl are good infos, but what I also would need is the value for "Attribution". I know, not all files have it, but this would be no problem. – Gerhard Oct 08 '14 at 09:27
  • Accepted as answer, since "Artist" seems to be the metadata, which contains the "Attribution" info. – Gerhard Oct 08 '14 at 11:17
  • 1
    Of note: The extension powering this magic is [Extension:CommonsMetadata](https://www.mediawiki.org/wiki/Extension:CommonsMetadata) by Brian Wolff. There are plans to [move this kind of data into a database](https://commons.wikimedia.org/wiki/Commons:Wikidata_for_media_info). – Rainer Rillke Feb 11 '15 at 02:26