Wikimedia API获取生成器元数据 [英] Wikimedia API get generator metadata
问题描述
我想从Wikimedia Commons获取页面,看来我仍然不了解Wikimedia API的用法.
I want to get pages from Wikimedia Commons and it seems, that I have still not understand the usage of the Wikimedia API.
我使用以下查询
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
除了我没有得到grsinfo/generator元数据之外,这还算不错.但是我需要结果的总数(总点击数).
Which works great, except that I don't get the grsinfo / generator metadata. But I need the total amount of results (totalhits).
有什么建议吗?
推荐答案
每个文档,
还应注意,生成器仅将页面标题传递给真实"查询,而不自行输出任何信息.因此,设置gcmprop之类的参数将无效.
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.
如果需要点击数,则必须执行常规搜索API查询,从中手动生成页面列表,然后在第二个API请求中进行查询.
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.
这篇关于Wikimedia API获取生成器元数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!