google-maps-link-parser
google-maps-link-parser is a Bun-first TypeScript library for working with public shared Google Maps URLs.
It does three things well:
Parse
Pure URL analysis with zero network calls.
Unfurl
SSRF-safe redirect following for
maps.app.goo.gl and goo.gl/maps.Enrich
Optional Google API lookups with explicit cost controls.
Why this package exists
Real Google Maps links are inconsistent in the wild. You will see:- coordinate views like
@24.7136,46.6753,15z - dropped pins like
?q=24.7136,46.6753 - legacy center parameters like
ll=24.7136,46.6753 data=!3d...!4d...payloads- place pages with
ftididentifiers - directions and search URLs
- short links that require multiple redirects before they become useful
Design principles
The package only targets public shared URLs. Private, authenticated, or unsupported
Google share flows fail clearly instead of being guessed.
- Early exits and typed boundaries
- Direct parsing before network work
- Strong hostname validation on every redirect hop
- Explicit source attribution for coordinates and metadata
- Raw artifacts only when you opt in
What you get back
Every mode returns the same top-level object:Start here
Install
Bun, npm, and pnpm setup.
Quick start
Parse a direct Maps URL and unfurl a short link.