如何搭配MediaWiki API得到一个类别,不能在一个又一个的所有图像? [英] How to get with Mediawiki API all images in a category which are not in another one?

查看:163
本文介绍了如何搭配MediaWiki API得到一个类别,不能在一个又一个的所有图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我完全新的API,很抱歉,如果问题是愚蠢的。

I am entirely new to API, so sorry if the question is silly.

我想获得的所有图像在下议院一类让我们说X,但不包括那些还在另一个(Y)。如果我能真正做到这一点,我不明白。

I would like to get all images in a category in Commons let's say X, but exclude those which are also in another one (Y). I do not understand if I can actually do this.

<一个href=\"https://commons.wikimedia.org/w/api.php?action=query&list=categorymembers&cmtype=file&cmtitle=Category:X\" rel=\"nofollow\">https://commons.wikimedia.org/w/api.php?action=query&list=categorymembers&cmtype=file&cmtitle=Category:X

会得到所有的人,如何排除一些?

will get all of them, how to exclude some?

此外,我想在结果有图像的说明中,不只是该文件的名称,是可能的?

moreover I would like in the result to have the description of the images, not just the name of the file, is that possible?

推荐答案

据我所知,有没有办法让直接使用API​​。但是,假设两个类别是相当小的,你可以从他们两人得到的所有图像,然后计算在你的code的补充。

AFAIK, there is no way to get that directly using the API. But, assuming both categories are reasonably small, you could get all images from both of them and then compute the complement in your code.

要检索的描述,可以使用的<$c$c>prop=imageinfo&iiprop=extmetadata&iiextmetadatafilter=ImageDescription.

To retrieve the description, you can use prop=imageinfo&iiprop=extmetadata&iiextmetadatafilter=ImageDescription.

在您的例子查询的情况下,它应该是这样的:

In the context of your example query, it would look like this:

<一个href=\"https://commons.wikimedia.org/w/api.php?action=query&generator=categorymembers&gcmtype=file&gcmtitle=Category:X&prop=imageinfo&iiprop=extmetadata&iiextmetadatafilter=ImageDescription\" rel=\"nofollow\">https://commons.wikimedia.org/w/api.php?action=query&generator=categorymembers&gcmtype=file&gcmtitle=Category:X&prop=imageinfo&iiprop=extmetadata&iiextmetadatafilter=ImageDescription

这篇关于如何搭配MediaWiki API得到一个类别,不能在一个又一个的所有图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆