Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Kind Example
:pin https://www.pinterest.com/pin/123456789/
:short https://pin.it/AbC123
:profile https://www.pinterest.com/savepinner/
:board https://www.pinterest.com/savepinner/media-tools/
:ideas https://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

About

Zero-dependency Clojure library for parsing and normalizing Pinterest URLs

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages