Wikimedia API get generator metadata

放肆的年华 提交于 2019-12-12 04:09:50

问题


I want to get pages from Wikimedia Commons and it seems, that I have still not understand the usage of the Wikimedia API.

I use the following query

https://commons.wikimedia.org/w/api.php?action=query&prop=imageinfo&format=json&iiprop=url|size|mime|mediatype|extmetadata&iiurlwidth=150&generator=search&gsrsearch=transformation&gsrnamespace=6&gsrlimit=9&gsroffset=0&gsrinfo=totalhits

See in API Sandbox

Which works great, except that I don't get the grsinfo / generator metadata. But I need the total amount of results (totalhits).

Any suggestions?


回答1:


Per the docs,

It should also be noted that generators only pass page titles to the 'real' query, and do not output any information themselves. Setting parameters like gcmprop will therefore have no effect.

If you need the hit count, you'll have to do a normal search API query, manually generate a list of pages from it and query them in a second API request.



来源:https://stackoverflow.com/questions/33997370/wikimedia-api-get-generator-metadata

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