Reads a release out of a Bandcamp page, for bandcamp-streams.ts. Every
track and album page carries the whole release, stream URLs included, as
HTML-escaped JSON in a data-tralbum attribute, so one fetch covers an
album. The format is undocumented, so every field is treated as optional.
f
parseTralbum(): Tralbum | null
html: string,
sourceUrl: string
Returns the release on the Bandcamp page html, fetched from sourceUrl;
null when the page has no release data, no audio or no streamable track.
Stream URLs outside bcbits.com are dropped.
v
BANDCAMP_HOST_RE: RegExp
Matches the hostnames bandcamp-streams.ts accepts: bandcamp.com and its
subdomains, and not bandcamp.com.example.org. An artist on a custom domain
doesn't match, and the player falls back to the embed.
Usage
import * as mod from "api/remote/bandcamp-tralbum.ts";