Parse, classify, and normalize Pinterest URLs without network requests
Project description
pinterest-url-normalizer
Parse, classify, and normalize Pinterest URLs without making network requests.
SavePinner · 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 immutableParsedPinterestUrl. It raisesPinterestUrlErrorwith codeINVALID_URLorUNSUPPORTED_URLon 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 is maintained by the team behind SavePinner, a browser tool for inspecting media exposed by public Pinterest Pin URLs. The package 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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pinterest_url_normalizer-0.1.0.tar.gz.
File metadata
- Download URL: pinterest_url_normalizer-0.1.0.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
876fcf98040a94932f85de1134bf0cafe03d55deebe6df9881b336c90a7814b8
|
|
| MD5 |
ae5f1870f43319d8c1d44a894974c4b8
|
|
| BLAKE2b-256 |
8fe2354069a55b034760ab74de2104e2fece1421e98c009d64eb4ec3e2bdc4fb
|
Provenance
The following attestation bundles were made for pinterest_url_normalizer-0.1.0.tar.gz:
Publisher:
publish-pypi.yml on jiankn/pinterest-url-normalizer-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pinterest_url_normalizer-0.1.0.tar.gz -
Subject digest:
876fcf98040a94932f85de1134bf0cafe03d55deebe6df9881b336c90a7814b8 - Sigstore transparency entry: 2311392644
- Sigstore integration time:
-
Permalink:
jiankn/pinterest-url-normalizer-python@a12657a20437cc92648578d494051764708572ca -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/jiankn
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@a12657a20437cc92648578d494051764708572ca -
Trigger Event:
release
-
Statement type:
File details
Details for the file pinterest_url_normalizer-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pinterest_url_normalizer-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5b72eccf55f0664d192c71ce3e3a035fa82ceb856719303b83e15bb5b1179318
|
|
| MD5 |
bd2f7b73e55d7bc4dad21fc0502f3605
|
|
| BLAKE2b-256 |
a7b9e13a19182eec312e2a9dda35a0a6f23131cad5ce5a8b9b573dbebebb11f1
|
Provenance
The following attestation bundles were made for pinterest_url_normalizer-0.1.0-py3-none-any.whl:
Publisher:
publish-pypi.yml on jiankn/pinterest-url-normalizer-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pinterest_url_normalizer-0.1.0-py3-none-any.whl -
Subject digest:
5b72eccf55f0664d192c71ce3e3a035fa82ceb856719303b83e15bb5b1179318 - Sigstore transparency entry: 2311392646
- Sigstore integration time:
-
Permalink:
jiankn/pinterest-url-normalizer-python@a12657a20437cc92648578d494051764708572ca -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/jiankn
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@a12657a20437cc92648578d494051764708572ca -
Trigger Event:
release
-
Statement type: