Skip to main content

pinterest-url-normalizer

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

TypeScript package on JSR · Source code

The package 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

python -m pip install pinterest-url-normalizer

Python API

from pinterest_url_normalizer import (
    is_pinterest_url,
    normalize_pinterest_url,
    parse_pinterest_url,
)

parsed = parse_pinterest_url("https://de.pinterest.com/pin/987654321/?utm_source=share")

print(parsed.kind)  # pin
print(parsed.pin_id)  # 987654321
print(parsed.normalized_url)  # https://www.pinterest.com/pin/987654321/

is_pinterest_url("https://pin.it/AbC123")
normalize_pinterest_url("https://pinterest.co.uk/savepinner/media-tools/")

Command line

Normalize URL arguments:

pinterest-url-normalizer \
  "https://pinterest.co.uk/pin/123/?utm_source=share" \
  "https://pin.it/AbC123"

Or pipe one URL per line and emit JSON Lines:

printf '%s\n' 'https://www.pinterest.com/pin/123/' | \
  pinterest-url-normalizer --json

The command exits with status 1 when any input is invalid and 2 when no input is provided.

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.

API

  • parse_pinterest_url(value) returns an immutable ParsedPinterestUrl. It raises PinterestUrlError with code INVALID_URL or UNSUPPORTED_URL on failure.
  • normalize_pinterest_url(value) returns the canonical URL.
  • is_pinterest_url(value) validates a supported URL form.
  • is_pinterest_host(host) checks a hostname against the exact country-domain allow list.

Why this package exists

This parser only prepares canonical links; it never fetches media. When a public Pin contains a still image, continue in the Pinterest image downloader to compare the image and thumbnail variants exposed for that Pin. The package itself 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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pinterest_url_normalizer-0.1.2.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pinterest_url_normalizer-0.1.2-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file pinterest_url_normalizer-0.1.2.tar.gz.

File metadata

  • Download URL: pinterest_url_normalizer-0.1.2.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pinterest_url_normalizer-0.1.2.tar.gz
Algorithm Hash digest
SHA256 7860de78a02d0f17e6e89f4be81f55ac61cf9bea711f59b8fb5e8cb4c4416eca
MD5 4b19d1ea5ea23287c7598ac22112d324
BLAKE2b-256 24ef0294d5141497375781262ad1b9ea06c76b40027c33f7f52119cac47b6fdd

See more details on using hashes here.

Provenance

The following attestation bundles were made for pinterest_url_normalizer-0.1.2.tar.gz:

Publisher: publish-pypi.yml on jiankn/pinterest-url-normalizer-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pinterest_url_normalizer-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for pinterest_url_normalizer-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9bf5d46b5492855655f81f2cb601a48d942c8fe83f0172d135e6982eddbb58f8
MD5 eaf0d05f0a24046a007944d5c157e022
BLAKE2b-256 1b99645b681d92ef6a0384084fb1d7aff55f0e0e80d2edc588500037140946c9

See more details on using hashes here.

Provenance

The following attestation bundles were made for pinterest_url_normalizer-0.1.2-py3-none-any.whl:

Publisher: publish-pypi.yml on jiankn/pinterest-url-normalizer-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page