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

Metadata

Release files for pinterest-url-normalizer 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pinterest-url-normalizer 0.1.2
File Size Uploaded Provenance Actions
pinterest_url_normalizer-0.1.2.tar.gz 6.8 kB With provenance Details for pinterest_url_normalizer-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pinterest-url-normalizer 0.1.2
File Interpreter ABI Platform Actions
pinterest_url_normalizer-0.1.2-py3-none-any.whl Python 3 none any Details for pinterest_url_normalizer-0.1.2-py3-none-any.whl

Total release size: 14.5 kB

Release files / pinterest_url_normalizer-0.1.2.tar.gz

Download URL pinterest_url_normalizer-0.1.2.tar.gz
Size 6.8 kB
Tags Source
SHA-256 checksum
How to use checksums
7860de78a02d0f17e6e89f4be81f55ac61cf9bea711f59b8fb5e8cb4c4416eca
BLAKE2b-256 checksum
How to use checksums
24ef0294d5141497375781262ad1b9ea06c76b40027c33f7f52119cac47b6fdd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 4, 2026.

Transparency log

Release files / pinterest_url_normalizer-0.1.2-py3-none-any.whl

Download URL pinterest_url_normalizer-0.1.2-py3-none-any.whl
Size 7.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9bf5d46b5492855655f81f2cb601a48d942c8fe83f0172d135e6982eddbb58f8
BLAKE2b-256 checksum
How to use checksums
1b99645b681d92ef6a0384084fb1d7aff55f0e0e80d2edc588500037140946c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 4, 2026.

Transparency log

Security for pinterest-url-normalizer 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pinterest_url_normalizer-0.1.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 4, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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