3 unstable releases

0.2.0 Sep 28, 2021
0.1.1 Aug 13, 2020
0.1.0 Jun 16, 2020

#6 in #wikimedia

26 downloads per month

GPL-3.0-or-later

16KB
143 lines

w-wiki

crates.io docs.rs pipeline status coverage report

The w-wiki crate helps shorten URLs using the w.wiki service. See the URL shortener documentation for more details.

License

w-wiki is (C) 2020-2021 Kunal Mehta, released under the GPLv3 or any later version, see COPYING for details.


lib.rs:

w-wiki

Conveniently shorten URLs using the w.wiki service. Only some Wikimedia projects are supported, see the documentation for more details.

w-wiki's primary shorten function is asynchronous.

let short_url = w_wiki::shorten("https://www.wikidata.org/wiki/Q575650")
    .await.unwrap();

If you plan on making multiple requests, a Client is available that holds connections.

let client = w_wiki::Client::new();
let short_url = client.shorten("https://www.wikidata.org/wiki/Q575650")
    .await.unwrap();

This library can be used by any MediaWiki wiki that has the UrlShortener extension installed.

let client = w_wiki::Client::new_for_api("https://example.org/w/api.php");

Dependencies

~4–18MB
~260K SLoC