PinterestUrlNormalizer (Pinterest URL Normalizer v0.1.0)

Copy Markdown View Source

Parses and normalizes supported Pinterest URLs without network requests.

The parser uses an exact hostname allowlist and removes query parameters and fragments from normalized URLs.

Summary

Functions

Returns the canonical form of a supported Pinterest URL.

Parses a Pinterest URL into its class, canonical URL, and identifier.

Parses a Pinterest URL and raises PinterestUrlNormalizer.Error on failure.

Returns whether a hostname exactly matches a supported Pinterest domain.

Returns whether the input is a supported Pinterest URL.

Functions

normalize(input)

@spec normalize(String.t()) :: String.t()

Returns the canonical form of a supported Pinterest URL.

Raises PinterestUrlNormalizer.Error for invalid or unsupported input.

parse(input)

@spec parse(term()) ::
  {:ok, PinterestUrlNormalizer.Result.t()}
  | {:error, PinterestUrlNormalizer.Error.t()}

Parses a Pinterest URL into its class, canonical URL, and identifier.

parse!(input)

Parses a Pinterest URL and raises PinterestUrlNormalizer.Error on failure.

pinterest_host?(host)

@spec pinterest_host?(term()) :: boolean()

Returns whether a hostname exactly matches a supported Pinterest domain.

pinterest_url?(input)

@spec pinterest_url?(term()) :: boolean()

Returns whether the input is a supported Pinterest URL.