/** * AudioEmbedService — Parse URLs and return embed HTML * Supports: Spotify, Bandcamp, SoundCloud, Apple Music, YouTube, Vimeo * * Usage in post content: *
https://open.spotify.com/track/123abc
* → *https://url
(bare URL — when GFM auto-link is off) * (marked GFM auto-link — what we get) * Either way →\s*(?:]*?\shref="([^"]+)"[^>]*>[^<]*<\/a>|(https?:\/\/[^\s<>"']+))\s*<\/p>/gi,
(match, hrefUrl, bareUrl) => {
const url = hrefUrl || bareUrl;
const detected = this.detectProvider(url);
if (detected) {
const iframe = this.generateIframe(detected.provider, detected);
return iframe || match;
}
return match;
}
);
}
/**
* Replace [[embed: ${artistH} ${album.tracks.length} track${album.tracks.length === 1 ? '' : 's'}${titleH}
${artistH ? `
${trackItems}