Wikipedia查询过滤器祖先类别

时间:2019-09-10 15:04:16

标签: json wikipedia wikipedia-api

发送请求:

{
        "action": "query",
        "format": "json",
        "prop": "categories",
        "titles": "Barry Archbold",
        "redirects": 1,
        "utf8": 1,
        "formatversion": "2",
        "clcategories": "Category:Living people"  //one of this page's category
}

返回响应:

{
    "batchcomplete": true,
    "query": {
        "pages": [
            {
                "pageid": 40902107,
                "ns": 0,
                "title": "Barry Archbold",
                "categories": [
                    {
                        "ns": 14,
                        "title": "Category:Living people"
                    }]...

但是如果我根据Wiki's Category Treeclcategories更改为Category:Life的父类别之一Category:Living people,则categories数组将不会显示在响应中:

{
    "batchcomplete": true,
    "query": {
        "pages": [
            {
                "pageid": 40902107,
                "ns": 0,
                "title": "Barry Archbold"
            }
        ]
    }
}

按标题查询时,是否可以按祖先类别过滤响应?

0 个答案:

没有答案
相关问题