Liking cljdoc? Tell your friends :D

pinterest-url-normalizer

Parse, classify, and normalize Pinterest URLs without making network requests.

SavePinner · Clojars · cljdoc

The library recognizes Pin, pin.it, profile, board, and Ideas URLs across Pinterest country domains. It uses an exact host allow list, rejects HTTP URLs and lookalike domains, and removes tracking parameters from normalized output.

Install

With deps.edn:

net.clojars.jiankn/pinterest-url-normalizer {:mvn/version "0.1.0"}

With Leiningen:

[net.clojars.jiankn/pinterest-url-normalizer "0.1.0"]

Usage

(require '[savepinner.pinterest-url-normalizer :as pinterest])

(def parsed
  (pinterest/parse-pinterest-url
   "https://de.pinterest.com/pin/987654321/?utm_source=share"))

(:kind parsed)           ; => :pin
(:pin-id parsed)         ; => "987654321"
(:normalized-url parsed) ; => "https://www.pinterest.com/pin/987654321/"

(pinterest/pinterest-url? "https://pin.it/AbC123")
(pinterest/normalize-pinterest-url
 "https://pinterest.co.uk/savepinner/media-tools/")

parse-pinterest-url throws ExceptionInfo with :code :invalid-url or :code :unsupported-url when a value cannot be parsed.

Supported URL kinds

KindExample
:pinhttps://www.pinterest.com/pin/123456789/
:shorthttps://pin.it/AbC123
:profilehttps://www.pinterest.com/savepinner/
:boardhttps://www.pinterest.com/savepinner/media-tools/
:ideashttps://www.pinterest.com/ideas/space-wallpaper/926295399832/

pin.it links are classified and normalized but are not followed. Resolving them requires a network request and belongs in the consuming application.

Development

lein test
lein jar

Why this package exists

This parser is maintained by the team behind SavePinner, a browser tool for inspecting media exposed by public Pinterest Pin URLs. The library contains no downloader, tracking, browser automation, or remote code.

Pinterest is a trademark of Pinterest, Inc. This project is independent and is not affiliated with or endorsed by Pinterest.

License

MIT

Can you improve this documentation?Edit on GitHub

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close