问题
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?
回答1:
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.
来源:https://stackoverflow.com/questions/26252294/access-copyright-info-on-wikimedia-commons-via-api