Access copyright info on Wikimedia Commons via api

蹲街弑〆低调 提交于 2019-12-12 23:53:03

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!