Skip to content

Latest commit

 

History

History
41 lines (31 loc) · 1.11 KB

File metadata and controls

41 lines (31 loc) · 1.11 KB

Pinterest URL Normalizer for Swift

Parse, classify, and normalize Pinterest URLs without network requests. The library uses an exact Pinterest host allowlist and rejects lookalike domains, credentials, non-HTTPS URLs, encoded paths, and non-standard ports.

Swift Package Manager

dependencies: [
    .package(
        url: "https://github.com/jiankn/pinterest-url-normalizer-swift.git",
        from: "0.1.1"
    )
]

CocoaPods

pod 'PinterestURLNormalizer', '~> 0.1.1'

Usage

import PinterestURLNormalizer

let canonical = try PinterestURLNormalizer.normalize(
    "https://www.pinterest.co.uk/pin/example--123456789/?utm_source=test"
)
// https://www.pinterest.com/pin/123456789/

Supported URL classes are Pin, pin.it short link, profile, board, and Ideas. This package does not download media or make network requests. When an iOS app hands a canonical public Pin URL back to the user, SavePinner's Pinterest Downloader for iPhone explains the Safari download and Photos steps without requiring another app.

MIT licensed.