The project is in a healthy, maintained state
A network-free Pinterest URL parser and normalizer with an exact host allow list.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 5.0
~> 13.0
 Project Readme

pinterest-url-normalizer

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

RubyGems · RubyDoc.info · npm · PyPI · crates.io · Packagist · Go

The gem 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.

The gem deliberately ends at URL normalization. A Ruby CLI can print or open the normalized Pin URL in the Pinterest image downloader while media retrieval stays outside the gem.

Install

gem install pinterest-url-normalizer

Library

require "pinterest_url_normalizer"

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

parsed.pin_id
# => "987654321"

parsed.normalized_url
# => "https://www.pinterest.com/pin/987654321/"

CLI

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/' | \
  pinterest-url-normalizer --json

The process exits with status 1 when any input is invalid and status 2 for 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