A URL expansion engine that supports an extensive registry of shortening services. It combines fast domain detection with robust resolution strategies: HTTP redirect following, pattern-based extraction from intermediate HTML, and API-based expansion for shorteners that don’t emit standard 3xx redirects. Returns the canonical final URL with consistent error handling and configurable timeouts.
This module recognizes hundreds of popular URL shorteners and expands them to their true destination
- async
urlexpand = "0.3.0"and then
use std::time::Duration;
use urlexpand::unshorten;
fn main() {
let url = "https://bit.ly/3alqLKi";
assert!(unshorten(url, Some(Duration::from_secs(10))).await.is_ok()); // with timeout
assert!(unshorten(url, None).await.is_ok()); // without timeout
}- blocking
urlexpand = { version = "0.3.0", features = ["blocking"] }and then
use std::time::Duration;
use urlexpand::unshorten;
fn main() {
let url = "https://bit.ly/3alqLKi";
assert!(unshorten(url, Some(Duration::from_secs(10))).is_ok()); // with timeout
assert!(unshorten(url, None).is_ok()); // without timeout
}cargo run --example unshorten https://bit.ly/3alqLKi2cm.es- 2CM / l8.nuadf.ly- Adflyadfoc.us- AdFocusamzn.to- Amazonamzn.id- Dub.shatominik.com- part of Adf.lyay.gy- part of Adf.lyb.link- BLINKbhpho.to- BH Photo & Videobit.ly- Bitly Url Shortnerbit.do- Bitdobn.gy- BNGYbranch.io- Branch.iobuff.ly- Buffer URL Shortnercal.link- Dub.shceesty.com- part of sh.stchatg.pt- Dub.shchollo.to- Chollo Ecommercecli.re- Capsulinkcli.fm- Capsulinkcutt.ly- Cuttlycutt.us- Cutt usdb.tt- Dropboxdub.sh- Dub.shf.ls- Free Link Shortenerfa.by- part of rebrand.lyfb.me- Facebookfig.page- Dub.shflip.it- Flipboardfumacrom.com- part of Adf.lyggl.link- Dub.shgit.io- Githubgit.new- Dub.shgeni.us- Genius Linkgoo.gl- Google Service has now stopped their url shortening servicegoto.now- GOTO.NOWgns.io- part of trim (tr.im)hmm.rs- HMM.RSht.ly- part of Hootsuitehyperurl.co- SmartUrl.Itity.im- ity.im (it'-ee-i-am)intamema.compart of Adf.lyis.gd- IS GDj.gs- part of Adf.lyj.mp- part of Bitlykutt.it- Kuttl1nq.com- urlshort.devldn.im- part of trim (tr.im)lnkd.in- linkedinlinklyhq.com- Linkly HQmicroify.com- part of Adf.lymzl.la- Mozilla Orgnmc.sg- instra corporation ptynowlinks.net- Now Linksow.ly- part of Hootsuiteprf.hn- Partnerizeplu.sh- Plushq.gs- part of Adflyqr.ae- Quoraqr.net- QR Code URL shortner & generatorrebrand.ly- Rebrandlyrb.gy- RBGY Free URL Shortnerrlu.ru- RLU.RUrotf.lol- part of tinyurl.coms.click.aliexpress.com- Ali Expresss.coop- SCOOPs.id- SID (home.s.id)sh.st- shorte.stsoo.gd- Soo.Gdshortcm.xyz- part of SHORT.IOshort.gy- SHORT.IO Serviceshortcm.xyz- ShortCmshorturl.at- ShortURL Atsl1nk.com- urlshort.devsmu.sg- Singapore Management Universitysmq.tc- part of bit.lysnip.ly- Sniply.iosnipr.comsnipurl.comsnurl.comsplit.to- Linksplitspti.fi- Dub.shsurl.li- Hyperhost (Secom.com.ua)surl.lt- Hyperhost (Secom.com.ua)t.co- Twittert.co- Twittert.ly- T.LY Link Shortenert2m.io- T2M aka "Text to Marketing" (t2mio.com)tiny.cc- TinyCCtiny.pl- TinyPLtinyium.com- part of Adf.lytinyurl.com- TinyURLtinyurl.ae- TinyURLtiny.one- part of tinyurl.comtny.im- TNY.IMtny.sh- Linksplittr.im- trim (tr.im) by RedLotustrib.al- Tribal links shortneru.to- U TOv.gd- V GDvirg.in- Virginvzturl.com- Vzt URLwaa.ai- Akari Link Shortnerwashex.am- part of bit.lywe.tl- WeTransferx.co- GoDaddy URL Shortner (currently shutdown)y2u.be- YouTube URL Shortner by Firewrench inc.yt.vu- YT.vuyourwish.es- Your Wisheszpr.io- Zapier
Please feel free to contribute by making pull requests or even bug fixes.
Thanks in advance.
License: MIT