从Wikimedia Commons获取描述 [英] Get depictions from Wikimedia Commons

查看:134
本文介绍了从Wikimedia Commons获取描述的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Wikimedia Commons具有描述图片描述的新功能. 示例:

Wikimedia Commons has a new feature to describe what a picture depicts. Example:

如何使用 wikimedia-android-data-client 库调用还是REST HTTP请求?

How to get the "depicts" of a given image, as JSON, using either a wikimedia-android-data-client library call or a REST HTTP request?

推荐答案

您可以使用某些 Wikibase APIs (我认为目前尚不完善的文档或文档).例如.

You can use some of the Wikibase APIs (exactly which or how is not well-documented at the moment, I think). E.g.

https://commons.wikimedia .org/w/api.php?action = wbgetclaims& format = jsonfm& entity = M78893847

{
    "claims": {
        "P180": [
            {
                "mainsnak": {
                    "snaktype": "value",
                    "property": "P180",
                    "hash": "7754bb4b4dcf94dd0a6b8524351b22df21328a88",
                    "datavalue": {
                        "value": {
                            "entity-type": "item",
                            "numeric-id": 12280,
                            "id": "Q12280"
                        },
                        "type": "wikibase-entityid"
                    },
                    "datatype": "wikibase-item"
                },
                "type": "statement",
                "id": "M78893847$bf7f116a-4d08-0426-0e81-c9552a89fa63",
                "rank": "preferred"
            },
            {
                "mainsnak": {
                    "snaktype": "value",
                    "property": "P180",
                    "hash": "8ed7e126588c21d3cf88387d5ee875d528c00a74",
                    "datavalue": {
                        "value": {
                            "entity-type": "item",
                            "numeric-id": 1021645,
                            "id": "Q1021645"
                        },
                        "type": "wikibase-entityid"
                    },
                    "datatype": "wikibase-item"
                },
                "type": "statement",
                "id": "M78893847$7830fc04-4a1e-f289-93bc-69d6bbf3b7fd",
                "rank": "normal"
            }
        ]
    }
}

78893847是您可以通过查询API 获取的页面ID:

78893847 being the page ID which you can get via the query API: https://commons.wikimedia.org/w/api.php?action=query&format=jsonfm&formatversion=2&titles=File%3AMomoyo-brug%20in%20Shibaura%2C%20gezien%20richting%20het%20zuidoosten%2C%20-15%20maart%202019.jpg

{
    "batchcomplete": true,
    "query": {
        "pages": [
            {
                "pageid": 78893847,
                "ns": 6,
                "title": "File:Momoyo-brug in Shibaura, gezien richting het zuidoosten, -15 maart 2019.jpg"
            }
        ]
    }
}

这篇关于从Wikimedia Commons获取描述的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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