savepinner/pinterest-url-normalizer

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

Maintainers

Package info

github.com/jiankn/pinterest-url-normalizer-php

Homepage

pkg:composer/savepinner/pinterest-url-normalizer

Transparency log

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.1.0 2026-08-01 15:58 UTC

This package is auto-updated.

Last update: 2026-08-01 16:09:13 UTC


README

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

SavePinner · Packagist · npm · PyPI · crates.io

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 query parameters and fragments from normalized output.

Install

composer require savepinner/pinterest-url-normalizer

Library

<?php

use SavePinner\PinterestUrlNormalizer\PinterestUrlNormalizer;

$parsed = PinterestUrlNormalizer::parse(
    'https://de.pinterest.com/pin/987654321/?utm_source=share',
);

echo $parsed->pinId;        // 987654321
echo $parsed->normalizedUrl; // https://www.pinterest.com/pin/987654321/

PinterestUrlNormalizer::isPinterestUrl('https://pin.it/AbC123'); // true
PinterestUrlNormalizer::normalize(
    'https://pinterest.co.uk/savepinner/media-tools/',
); // https://www.pinterest.com/savepinner/media-tools/

CLI

Composer installs the pinterest-url-normalizer executable with the package.

vendor/bin/pinterest-url-normalizer \
  'https://de.pinterest.com/pin/987654321/?utm_source=share' \
  'https://pin.it/AbC123'

Read one URL per line and emit JSON Lines:

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

The process exits with status 1 when any input is invalid and status 2 for CLI usage errors.

Supported URLs

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.

License

MIT