Namespace: URLUtils

URLUtils

Because many sites generate multiple URLs or URL variants pointing to the same resource, we standardize user-submitted URLs before storing or querying them. This reduces the need for manual merging.

This module also can tag some known URLs according to predefined tags like 'shops' and 'reviews'.

Source:

Methods

(protected, static) _stripFragment(inputURL) → {String}

Generic converter to discard the fragment portion of an input URL. This can be useful for sites where fragments are frequently used and likely to be part of the URL a user copies into the clipboard.

Parameters:
Name Type Description
inputURL String

any URL

Source:
Returns:

URL without fragment

Type
String

(protected, static) _stripOpenLibraryTitleSuffix(inputURL) → {String}

Open Library "work" and "edition" URLs contain a human-readable string at the end, derived from the title. This string is optional, and it causes problems matching URLs against each other, so we remove it.

Parameters:
Name Type Description
inputURL String

the Open Library URL

Source:
Returns:

canonicalized URL

Type
String