【问题标题】:How do I get the current MediaWiki version using the API?如何使用 API 获取当前的 MediaWiki 版本?
【发布时间】:2017-06-06 07:31:32
【问题描述】:

使用MediaWiki API如何获取版本号?

【问题讨论】:

    标签: mediawiki mediawiki-api


    【解决方案1】:

    您需要/w/api.php?action=query&format=json&prop=&meta=siteinfo。这将为您提供所需的一切(以及更多)。这是它从 en.wikipedia.org 返回的内容:

    {
        "batchcomplete": "",
        "query": {
            "general": {
                "mainpage": "Main Page",
                "base": "https://en.wikipedia.org/wiki/Main_Page",
                "sitename": "Wikipedia",
                "logo": "//en.wikipedia.org/static/images/project-logos/enwiki.png",
                "generator": "MediaWiki 1.30.0-wmf.2",
                "phpversion": "5.6.99-hhvm",
                "phpsapi": "srv",
                "hhvmversion": "3.18.2",
                "dbtype": "mysql",
                "dbversion": "10.0.29-MariaDB",
                "imagewhitelistenabled": "",
                "langconversion": "",
                "titleconversion": "",
                "linkprefixcharset": "",
                "linkprefix": "",
                "linktrail": "/^([a-z]+)(.*)$/sD",
                "legaltitlechars": " %!\"$&'()*,\\-.\\/0-9:;=?@A-Z\\\\^_`a-z~\\x80-\\xFF+",
                "invalidusernamechars": "@:",
                "fixarabicunicode": "",
                "fixmalayalamunicode": "",
                "git-hash": "b40805ff461884e48400adb3000fa06f9b6ff4c9",
                "git-branch": "wmf/1.30.0-wmf.2",
                "case": "first-letter",
                "lang": "en",
                "fallback": [],
                "fallback8bitEncoding": "windows-1252",
                "writeapi": "",
                "maxarticlesize": 2097152,
                "timezone": "UTC",
                "timeoffset": 0,
                "articlepath": "/wiki/$1",
                "scriptpath": "/w",
                "script": "/w/index.php",
                "variantarticlepath": false,
                "server": "//en.wikipedia.org",
                "servername": "en.wikipedia.org",
                "wikiid": "enwiki",
                "time": "2017-06-05T23:28:54Z",
                "misermode": "",
                "uploadsenabled": "",
                "maxuploadsize": 4294967296,
                "minuploadchunksize": 1024,
                "galleryoptions": {
                    "imagesPerRow": 0,
                    "imageWidth": 120,
                    "imageHeight": 120,
                    "captionLength": "",
                    "showBytes": "",
                    "mode": "traditional"
                },
                "thumblimits": [
                    120,
                    150,
                    180,
                    200,
                    220,
                    250,
                    300,
                    400
                ],
                "imagelimits": [
                    {
                        "width": 320,
                        "height": 240
                    },
                    {
                        "width": 640,
                        "height": 480
                    },
                    {
                        "width": 800,
                        "height": 600
                    },
                    {
                        "width": 1024,
                        "height": 768
                    },
                    {
                        "width": 1280,
                        "height": 1024
                    }
                ],
                "favicon": "//en.wikipedia.org/static/favicon/wikipedia.ico",
                "centralidlookupprovider": "CentralAuth",
                "allcentralidlookupproviders": [
                    "CentralAuth",
                    "local"
                ],
                "interwikimagic": "",
                "magiclinks": {
                    "ISBN": "",
                    "PMID": "",
                    "RFC": ""
                },
                "wmf-config": {
                    "wmfMasterDatacenter": "eqiad"
                },
                "pageviewservice-supported-metrics": {
                    "pageviews": {
                        "pageviews": ""
                    },
                    "siteviews": {
                        "pageviews": "",
                        "uniques": ""
                    },
                    "mostviewed": {
                        "pageviews": ""
                    }
                }
            }
        }
    }
    

    我猜你需要那里的“生成器”属性。如果您愿意,可以在 Wikipedia 的 API sandbox 中进行测试。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-01-27
      • 2021-10-01
      • 2019-05-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多