User:Dispenser/Dablinks

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search

Processing disambiguation links[edit]

Point the correct article
Convert to red link
Link to wiktionary

API[edit]

The tool has a machine accessible interface which can be used by tools, bots, and scripts. The API has been designed very similar to the MediaWiki API.

Options[edit]

format
Changes the output format options are xml, json, and html
callback
When specified with format as JSON wraps the output into a given.
http://toolserver.org/~dispenser/cgi-bin/dablinks.py?titles=Ohio&format=json&callback=dabhighlight
disambiguationspage
Under consideration. Specify a page other than MediaWiki:Disambiguationspage. This would have the advantage of allowing templates indirectly related, such as {{dablink}}. This then could be a flag for further inspection.

Generators[edit]

titles
Pipe separated titles
headlinks
Downloads a page and parses links which appear apart of a header, designed for WP:FAC
category
Use the API to fetch a list of pages in a category. Use &limit= to set the limit, default: 10.

Output[edit]

Sample:

Note: The following does not conform to specifications, you should convert values to specifications for future compatibility.
{
    "query":{
        "pages":{
             "0":{
                "pageid":null,
                "ns":0,
                "title":"Ohio",
                "disambiguationlinks":[
{"ns":0, "title":"Carnation",             "linksback": 0, "template":"Disambig"},
{"ns":1, "title":"Mary_Taylor",           "linksback": 0, "template":"Hndis"},
{"ns":2, "title":"Miami_River",           "linksback": 0, "template":"Geodis"},
{"ns":3, "title":"Ohio_(disambiguation)", "linksback": 1, "template":"Disambig"},
{"ns":4, "title":"Racer_(snake)",         "linksback": 0, "template":"Disambig", "targetns":0, "target":"Racer"},
{"ns":0, "title":"Timken",                "linksback": 0, "template":"Disambig"}
                ]
            }
        }
    }
}
ns
The namespace number of page's namespace
title
The title of the page including the namespace
linksback
Zero or one depending if the target page links to the starting page. Useful in filtering out primary topic disambiguation pages
targetns
Namespace number of the target redirect.
target
Full title of target redirect.

Limitations[edit]

  • Because of current limitation in webpywikipedia only canonical namespace (i.e. English only) are correctly handled.
  • Redirect handling and first-letter capitalization (canonical naming) only working in the HTML mode.
  • Does not throw a warning with pages tagged with {{redirect}}, for , or any variant based on {{dablink}}

See Also[edit]