@hackage / pinterest-url-normalizer

Parse and normalize Pinterest URLs without network requests

Latest0.1.1.0

About

Metadata

  • Last updated , by jiankn
  • License MIT
  • Categories Web Development
  • Maintained by: jiankn@users.noreply.github.com

  • Lottery factor: 0

Links

Installation

Readme

pinterest-url-normalizer

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

SavePinner · Hackage

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, credentials, non-standard ports, and lookalike domains, and removes query parameters from normalized output.

Install

Add the package to your Cabal file:

build-depends: pinterest-url-normalizer ^>= 0.1.1.0

Usage

import SavePinner.PinterestURL

normalizePinterestUrl
  "https://de.pinterest.com/pin/987654321/?utm_source=share"
-- Right "https://www.pinterest.com/pin/987654321/"

parsePinterestUrl "https://pin.it/AbC123"
isPinterestUrl "https://www.pinterest.com/savepinner/media-tools/"

parsePinterestUrl returns Either ParseError PinterestUrl, so callers get a specific failure instead of an exception.

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

cabal update
cabal test
cabal check
cabal sdist

Why this package exists

This parser is maintained by the team behind the Pinterest image downloader, 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