normalizeAmazonImageUrl - itsManeka/amazing-scraper GitHub Wiki

amazing-scraper


amazing-scraper / normalizeAmazonImageUrl

Function: normalizeAmazonImageUrl()

normalizeAmazonImageUrl(url): string

Defined in: src/infrastructure/parsers/CheerioHtmlParser.ts:19

Normalises an Amazon product image URL to the ._SL500_ size suffix.

  • URLs that already contain a dimension suffix (._SX\d+_, ._SY\d+_, ._SL\d+_, ._AC_\w+_) have that suffix replaced by ._SL500_.
  • URLs that end with V1_.jpg (no dimension suffix) get ._SL500_ inserted before .jpg.
  • All other URLs are returned unchanged.

Parameters

url

string

Returns

string

⚠️ **GitHub.com Fallback** ⚠️