function canonicalizeUrl
canonicalizeUrl(raw: string): string | null

Returns the canonical key of raw, or null when it isn't an http(s) URL. A YouTube video or playlist becomes one fixed URL whatever shape it came in.

Parameters

raw: string

Return Type

string | null

Usage

import { canonicalizeUrl } from "api/lib/canonical-url.ts";