Jump to content

Toolserver:getWikiAPI

From mediawiki.org

This page was moved from the Toolserver wiki.
Toolserver has been replaced by Toolforge. As such, the instructions here may no longer work, but may still be of historical interest.
Please help by updating examples, links, template links, etc. If a page is still relevant, move it to a normal title and leave a redirect.


Category:Tools

Manual on MediaWiki Tools
getWikiAPI
Release status: unknown
Implementation API
Author(s) Krinkle
License No license specified
Download No link
https://toolserver.org/~krinkle/getWikiAPI/
Tags
data extraction, search, database access

Category:Tools by Krinkle

The getWikiAPI is an API that makes it easy to identify a wiki with the help from the toolserver database. Originally developed to help in situations like bug 26664.

Formats

[edit]

Currently is supports PHP (serialised) and JavaScript (JSON callback) as machine readable formats. For us humans there's also <pre>-texted output formats using var_dump and print_r available. By default it shows an XHTML page with a form for manual input.

Variation matching

[edit]

The query tries the following variations to find a match

  • dbname = input
  • dbname = input_p
  • dbname = inputwiki_p
  • domain = input
  • domain = input.org

Autocomplete

[edit]

If none of the variations or literals matched the following are attempted in the same query as fallback. Autocomplete sorts by size to determine the first (and only) result.

  • dname = inputwiki*
  • dname = input *
  • domain = input *

Parameters

[edit]
  • wikiids
    Pipe-separated string using any of the [[#Identifiers|]]. Multiple identifier types can be mixed. (required)
  • format
    may be php, json, php_dump or php_print. Default: xhtml
  • callback
    may be any string should only contain letters and numbers, without special characters or spaces. Default: getWikiAPI

Examples

[edit]

wikiids=meta|nlwiki_p|en.wikibooks   format=json   callback=myFunction

myFunction({
    "meta": {
        "input": "meta",
        "search": "meta",
        "match": true,
        "data": {
            "dbname": "metawiki_p",
            "lang": "en",
            "family": "wikimedia",
            "domain": "meta.wikimedia.org",
            "size": "18904",
            "is_meta": "1",
            "is_closed": "0",
            "is_multilang": "0",
            "is_sensitive": "0",
            "root_category": null,
            "server": "3",
            "script_path": "\/w\/",
            "wikicode": "metawiki",
            "localdomain": "meta.wikimedia",
            "url": "http:\/\/meta.wikimedia.org",
            "apiurl": "http:\/\/meta.wikimedia.org\/w\/api.php"
        }
    },
    "nlwiki_p": {
        "input": "nlwiki_p",
        "search": "nlwiki_p",
        "match": true,
        "data": {
            "dbname": "nlwiki_p",
            "lang": "nl",
            "family": "wikipedia",
            "domain": "nl.wikipedia.org",
            "size": "664925",
            "is_meta": "0",
            "is_closed": "0",
            "is_multilang": "0",
            "is_sensitive": "0",
            "root_category": null,
            "server": "2",
            "script_path": "\/w\/",
            "wikicode": "nlwiki",
            "localdomain": "nl.wikipedia",
            "url": "http:\/\/nl.wikipedia.org",
            "apiurl": "http:\/\/nl.wikipedia.org\/w\/api.php"
        }
    },
    "en.wikibooks": {
        "input": "en.wikibooks",
        "search": "en.wikibooks",
        "match": true,
        "data": {
            "dbname": "enwikibooks_p",
            "lang": "en",
            "family": "wikibooks",
            "domain": "en.wikibooks.org",
            "size": "35793",
            "is_meta": "0",
            "is_closed": "0",
            "is_multilang": "0",
            "is_sensitive": "0",
            "root_category": null,
            "server": "3",
            "script_path": "\/w\/",
            "wikicode": "enwikibooks",
            "localdomain": "en.wikibooks",
            "url": "http:\/\/en.wikibooks.org",
            "apiurl": "http:\/\/en.wikibooks.org\/w\/api.php"
        }
    }
});


wikiids=betawikiv|media|http://de.wikibooks.org/   format=php_print

Array
(
    [betawikiv] => Array
        (
            [input] => betawikiv
            [search] => betawikiv
            [match] => 1
            [data] => Array
                (
                    [dbname] => betawikiversity_p
                    [lang] => en
                    [family] => wikiversity
                    [domain] => beta.wikiversity.org
                    [size] => 1612
                    [is_meta] => 0
                    [is_closed] => 0
                    [is_multilang] => 1
                    [is_sensitive] => 0
                    [root_category] => 
                    [server] => 3
                    [script_path] => /w/
                    [wikicode] => betawikiversity
                    [localdomain] => beta.wikiversity
                    [url] => http://beta.wikiversity.org
                    [apiurl] => http://beta.wikiversity.org/w/api.php
                )

        )

    [media] => Array
        (
            [input] => media
            [search] => media
            [match] => 1
            [data] => Array
                (
                    [dbname] => mediawikiwiki_p
                    [lang] => en
                    [family] => mediawiki
                    [domain] => www.mediawiki.org
                    [size] => 5351
                    [is_meta] => 1
                    [is_closed] => 0
                    [is_multilang] => 0
                    [is_sensitive] => 0
                    [root_category] => 
                    [server] => 3
                    [script_path] => /w/
                    [wikicode] => mediawikiwiki
                    [localdomain] => www.mediawiki
                    [url] => http://www.mediawiki.org
                    [apiurl] => http://www.mediawiki.org/w/api.php
                )

        )

    [http://de.wikibooks.org/] => Array
        (
            [input] => http://de.wikibooks.org/
            [search] => de.wikibooks.org
            [match] => 1
            [data] => Array
                (
                    [dbname] => dewikibooks_p
                    [lang] => de
                    [family] => wikibooks
                    [domain] => de.wikibooks.org
                    [size] => 16672
                    [is_meta] => 0
                    [is_closed] => 0
                    [is_multilang] => 0
                    [is_sensitive] => 0
                    [root_category] => 
                    [server] => 3
                    [script_path] => /w/
                    [wikicode] => dewikibooks
                    [localdomain] => de.wikibooks
                    [url] => http://de.wikibooks.org
                    [apiurl] => http://de.wikibooks.org/w/api.php
                )

        )

)


wikiids=betawikiv|media|http://de.wikibooks.org/   format=php

a:3:{s:9:"betawikiv";a:4:{s:5:"input";s:9:"betawikiv";s:6:"search";s:9:"betawikiv";s:5:"match";b:1;s:4:"data";a:16:{s:6:"dbname";s:17:"betawikiversity_p";s:4:"lang";s:2:"en";s:6:"family";s:11:"wikiversity";s:6:"domain";s:20:"beta.wikiversity.org";s:4:"size";s:4:"1612";s:7:"is_meta";s:1:"0";s:9:"is_closed";s:1:"0";s:12:"is_multilang";s:1:"1";s:12:"is_sensitive";s:1:"0";s:13:"root_category";N;s:6:"server";s:1:"3";s:11:"script_path";s:3:"/w/";s:8:"wikicode";s:15:"betawikiversity";s:11:"localdomain";s:16:"beta.wikiversity";s:3:"url";s:27:"http://beta.wikiversity.org";s:6:"apiurl";s:37:"http://beta.wikiversity.org/w/api.php";}}s:5:"media";a:4:{s:5:"input";s:5:"media";s:6:"search";s:5:"media";s:5:"match";b:1;s:4:"data";a:16:{s:6:"dbname";s:15:"mediawikiwiki_p";s:4:"lang";s:2:"en";s:6:"family";s:9:"mediawiki";s:6:"domain";s:17:"www.mediawiki.org";s:4:"size";s:4:"5351";s:7:"is_meta";s:1:"1";s:9:"is_closed";s:1:"0";s:12:"is_multilang";s:1:"0";s:12:"is_sensitive";s:1:"0";s:13:"root_category";N;s:6:"server";s:1:"3";s:11:"script_path";s:3:"/w/";s:8:"wikicode";s:13:"mediawikiwiki";s:11:"localdomain";s:13:"www.mediawiki";s:3:"url";s:24:"http://www.mediawiki.org";s:6:"apiurl";s:34:"http://www.mediawiki.org/w/api.php";}}s:24:"http://de.wikibooks.org/";a:4:{s:5:"input";s:24:"http://de.wikibooks.org/";s:6:"search";s:16:"de.wikibooks.org";s:5:"match";b:1;s:4:"data";a:16:{s:6:"dbname";s:13:"dewikibooks_p";s:4:"lang";s:2:"de";s:6:"family";s:9:"wikibooks";s:6:"domain";s:16:"de.wikibooks.org";s:4:"size";s:5:"16672";s:7:"is_meta";s:1:"0";s:9:"is_closed";s:1:"0";s:12:"is_multilang";s:1:"0";s:12:"is_sensitive";s:1:"0";s:13:"root_category";N;s:6:"server";s:1:"3";s:11:"script_path";s:3:"/w/";s:8:"wikicode";s:11:"dewikibooks";s:11:"localdomain";s:12:"de.wikibooks";s:3:"url";s:23:"http://de.wikibooks.org";s:6:"apiurl";s:33:"http://de.wikibooks.org/w/api.php";}}}

Return

[edit]
  • (key): The key of the set is the string from the query that sent
    • input : same
    • search : The sanatized version used in the query (trimmed, hostname detection from url etc., trailing slash)
    • match : Boolean representing whether or not there was a match
    • data : Array containing the actual information

Uses

[edit]

Category:Data extracting tools Category:Search_tools Category:Database access tools