packages feed

pinterest-url-normalizer-0.1.1.0: README.md

# pinterest-url-normalizer

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

[SavePinner](https://savepinner.com/) · [Hackage](https://hackage.haskell.org/package/pinterest-url-normalizer)

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:

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

## Usage

```haskell
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

```bash
cabal update
cabal test
cabal check
cabal sdist
```

## Why this package exists

This parser is maintained by the team behind the
[Pinterest image downloader](https://savepinner.com/), 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