A very simple urlshortener for Rust.
This library aims to implement as much URL shortener services as possible and to provide an interface as minimal and simple as possible.
Currently the following URL shorteners are implemented:
With authentication:
goo.gl
bit.ly
Without authentication:
bn.gy
is.gd
readability.com
v.gd
bam.bz
fifo.cc
tiny.ph
tny.im
s.coop
bmeo.org
hmm.rs
url-shortener.io
The following services are supported, but are discouraged from use, due to restrictions such as rate limits:
tinyurl.com
psbe.co
rlu.ru
sirbz.com
hec.su
abv8.me
nowlinks.net
Without authentication
```rust extern crate urlshortener;
use urlshortener::UrlShortener;
fn main() { let us = UrlShortener::new(); let longurl = "https://google.com"; println!("Short url for google: {:?}", us.trygenerate(long_url, None)); } ```
With authentication (Goo.Gl)
```rust extern crate urlshortener;
use urlshortener::{ UrlShortener, Provider };
fn main() { let us = UrlShortener::new(); let longurl = "https://google.com"; let key = "MYAPIKEY"; println!("Short url for google: {:?}", us.generate(longurl, Provider::GooGl { apikey: key.toowned() })); } ```
Combined (Goo.Gl + Is.Gd)
```rust extern crate urlshortener;
use urlshortener::{ UrlShortener, Provider };
fn main() {
let us = UrlShortener::new();
let providers = vec![
Provider::GooGl { apikey: "MYAPIKEY".toowned() },
Provider::IsGd,
];
let longurl = "https://rust-lang.org";
println!("Short url for google: {:?}", us.trygenerate(long_url, Some(providers)));
}
```
This project is licensed under the MIT license.